From 67ee01d77cfac8f8090215c3974149774ebd8f20 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Fri, 20 Mar 2020 09:25:58 +0100 Subject: [PATCH] Replaced unneeded calloc() by malloc() --- dynstr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dynstr.c b/dynstr.c index 35d47b1..81d9a77 100644 --- a/dynstr.c +++ b/dynstr.c @@ -38,12 +38,12 @@ int dynstr_append(struct dynstr *const d, const char *const format, ...) if (!d->str) { new_len = src_len + 1; - d->str = calloc(src_len + 1, sizeof *d->str); + d->str = malloc(new_len * sizeof *d->str); } else { new_len = d->len + src_len + 1; - d->str = realloc(d->str, (d->len + src_len) * sizeof *d->str); + d->str = realloc(d->str, new_len * sizeof *d->str); } if (d->str)