summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/utils.c b/common/utils.c
index 80f7060..0f65f4a 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -161,7 +161,10 @@ void buffer_read_from_filename(const char *filename, char **buffer, uint64_t *le
}
*buffer = (char*)malloc(sizeof(char)*(size+1));
- fread(*buffer, sizeof(char), size, f);
+ if (fread(*buffer, sizeof(char), size, f) != size) {
+ fclose(f);
+ return;
+ }
fclose(f);
*length = size;