summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorGDR! <gdr@gdr.name>2015-07-07 19:15:11 +0200
committerGDR! <gdr@gdr.name>2015-07-07 19:15:11 +0200
commitec2d41d837c2a289ae8b72b4b45cc1b999621e35 (patch)
tree8463dbd2be282134873ad710eb18d96d89d635dd /util.c
parent70644b6231dc2f0329c5d8a06b90bed3d29da7dc (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.
Diffstat (limited to 'util.c')
-rw-r--r--util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util.c b/util.c
index 5d3fefe..a2f60de 100644
--- a/util.c
+++ b/util.c
@@ -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);