From dc9f35b35a7d7fd6e831f3ee287d1e7ad96e684e Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 18 Jun 2021 09:36:15 -0400 Subject: Replace all instances of `malloc()` with `calloc()` in `config.c`. --- config.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config.c b/config.c index d2c0ea4..129d44d 100644 --- a/config.c +++ b/config.c @@ -63,8 +63,7 @@ char *get_line(char **str) { for (i = 0; tmp[i] != '\n' && tmp[i] != '\0'; i++); - s = malloc(i+1); - memset(s, 0, i+1); + s = calloc(i+1, sizeof(char)); memcpy(s, *str, i); *str += (i+1); @@ -73,7 +72,7 @@ char *get_line(char **str) { char *make_str(const char *str) { const size_t length = strlen(str); - char *s = malloc(length+1); + char *s = calloc(length+1, sizeof(char)); memcpy(s, str, length+1); return s; } -- cgit v1.2.3-13-gbd6f