diff options
author | P. J. McDermott <pj@pehjota.net> | 2023-02-24 10:07:19 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2023-02-24 10:07:19 (EST) |
commit | 33890e7b9aab0d7f77c8d00a289c2a128373f1b2 (patch) | |
tree | 9b669536558ac93418ce282af22af1d3f440433d /src | |
parent | 0b360f0c7de63ddb9bb20d2fead9e077d9fef735 (diff) | |
download | overworld-rpg-33890e7b9aab0d7f77c8d00a289c2a128373f1b2.zip overworld-rpg-33890e7b9aab0d7f77c8d00a289c2a128373f1b2.tar.gz overworld-rpg-33890e7b9aab0d7f77c8d00a289c2a128373f1b2.tar.bz2 |
demo: Prevent potential null pointer dereferences
Diffstat (limited to 'src')
-rw-r--r-- | src/demo.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -125,7 +125,13 @@ demo(void) SDL_Palette *pal_start, *pal_end; pal = malloc(sizeof(*pal)); + if (pal == NULL) { + err(1, "Failed to allocate palette"); + } pal->colors = calloc(64, sizeof(*pal->colors)); + if (pal->colors == NULL) { + err(1, "Failed to allocate palette colors"); + } pal->ncolors = 64; i = 0; |