diff options
author | the xhr <xhr@giessen.ccc.de> | 2021-08-25 14:04:07 +0200 |
---|---|---|
committer | the xhr <xhr@giessen.ccc.de> | 2021-08-25 14:04:07 +0200 |
commit | cebc5223abdec2d1d1862960ff0c473850eba134 (patch) | |
tree | 00cd16a2fea8c48e1b7a5f40b46d4501fa1ee4f9 | |
parent | 603332391cfd7951818975b787b57c38a3ce46d0 (diff) |
Replace malloc() in xmalloc() with calloc()
so that all memory get zero'ed out at allocation time. Remove a
then useless memset
-rw-r--r-- | request.c | 2 | ||||
-rw-r--r-- | util.c | 2 |
2 files changed, 1 insertions, 3 deletions
@@ -39,8 +39,6 @@ uridecode(const char *request) const char *p; char *pt; - memset(temp, 0, strlen(request)+1); - p = request; pt = temp; @@ -27,7 +27,7 @@ xmalloc(size_t size) if (size == 0) fatal("xmalloc: zero size"); - ptr = malloc(size); + ptr = calloc(1, size); if (ptr == NULL) fatal("xmalloc: out of memory (allocating %zu bytes)", size); return ptr; |