diff options
| author | Xavier Del Campo Romero <xavier.delcampo@orain.io> | 2020-03-20 09:25:58 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavier.delcampo@orain.io> | 2020-03-20 09:25:58 +0100 |
| commit | 67ee01d77cfac8f8090215c3974149774ebd8f20 (patch) | |
| tree | d457114139a6bbb407e256fc46f0b576764b36f3 | |
| parent | 73dd849484cee9c46c24582fc6537bc68c18fdce (diff) | |
| download | dynstr-67ee01d77cfac8f8090215c3974149774ebd8f20.tar.gz | |
Replaced unneeded calloc() by malloc()
| -rw-r--r-- | dynstr.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) |
