summaryrefslogtreecommitdiff
path: root/os_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'os_unix.c')
-rw-r--r--os_unix.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/os_unix.c b/os_unix.c
index 69ba25a3e8566..7e3ab4adb4a5b 100644
--- a/os_unix.c
+++ b/os_unix.c
@@ -216,7 +216,12 @@ char * os_readfile(const char *name, size_t *len)
return NULL;
}
- fread(buf, 1, *len, f);
+ if (fread(buf, 1, *len, f) != *len) {
+ fclose(f);
+ free(buf);
+ return NULL;
+ }
+
fclose(f);
return buf;