summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jshn.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/jshn.c b/jshn.c
index 9639951..28cfa8d 100644
--- a/jshn.c
+++ b/jshn.c
@@ -354,7 +354,7 @@ static int jshn_parse_file(const char *path)
return 3;
}
- if (!(fbuf = malloc(sb.st_size))) {
+ if (!(fbuf = calloc(1, sb.st_size+1))) {
fprintf(stderr, "Error allocating memory for %s\n", path);
close(fd);
return 3;