diff options
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -35,7 +35,7 @@ char *read_file(const char *filename, long *size) { } /* Allocate enough space for the entire file, plus one. */ - buf = malloc(filesize+1); + buf = calloc(filesize+1, sizeof(char)); /* Return NULL, if the buffer wasn't allocated. */ if (buf == NULL) { @@ -43,9 +43,6 @@ char *read_file(const char *filename, long *size) { return NULL; } - /* Zero out the buffer. */ - memset(buf, 0, filesize+1); - /* Seek back to the start of the file. */ rewind(fp); /* Read the entire file contents into the buffer. */ |