summaryrefslogtreecommitdiff
path: root/os_unix.c
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2009-01-15 04:25:21 +0000
committerSam Leffler <sam@FreeBSD.org>2009-01-15 04:25:21 +0000
commit22188e6ab4f02f981de3b9f228a40b1e8f98e6a1 (patch)
treee396cb7a4849178b23486ba07b66a6dfede1d1e9 /os_unix.c
parent17914a6ec9e4814998abdaec5a947b6a78709a19 (diff)
Notes
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;