diff options
author | GDR! <gdr@gdr.name> | 2015-07-07 19:15:11 +0200 |
---|---|---|
committer | GDR! <gdr@gdr.name> | 2015-07-07 19:15:11 +0200 |
commit | ec2d41d837c2a289ae8b72b4b45cc1b999621e35 (patch) | |
tree | 8463dbd2be282134873ad710eb18d96d89d635dd | |
parent | 70644b6231dc2f0329c5d8a06b90bed3d29da7dc (diff) |
CID 122511 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)4.
negative_returns: len is passed to a parameter that cannot be negative.
-rw-r--r-- | util.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -157,6 +157,11 @@ void* file_raw(char *path, uint32_t *size) | |||
157 | 157 | ||
158 | fseek(file, 0, SEEK_END); | 158 | fseek(file, 0, SEEK_END); |
159 | len = ftell(file); | 159 | len = ftell(file); |
160 | if(len <= 0) | ||
161 | { | ||
162 | fclose(file); | ||
163 | return NULL; | ||
164 | } | ||
160 | data = malloc(len); | 165 | data = malloc(len); |
161 | if(!data) { | 166 | if(!data) { |
162 | fclose(file); | 167 | fclose(file); |