summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/config.c b/config.c
index 6b1da23..d2c0ea4 100644
--- a/config.c
+++ b/config.c
@@ -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. */