diff options
Diffstat (limited to 'tools/palette.c')
-rw-r--r-- | tools/palette.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/palette.c b/tools/palette.c index ebb8e4fbf..397c62651 100644 --- a/tools/palette.c +++ b/tools/palette.c @@ -50,9 +50,17 @@ void print_palette(char* palette_filename) { fseek(f, 0, SEEK_END); size = ftell(f); + if (!size) { + fprintf(stderr, "empty file %s\n", palette_filename); + exit(1); + } rewind(f); bytes = malloc(size); + if (!bytes) { + fprintf(stderr, "malloc failure\n"); + exit(1); + } fseek(f, 0, SEEK_SET); fread(bytes, 1, size, f); |