diff options
Diffstat (limited to 'lib/abuf.c')
-rw-r--r-- | lib/abuf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/abuf.c b/lib/abuf.c index 4b17e0b8c0d..1635d58682c 100644 --- a/lib/abuf.c +++ b/lib/abuf.c @@ -51,9 +51,11 @@ bool abuf_realloc(struct abuf *abuf, size_t new_size) /* not currently allocated and new size is larger. Alloc and * copy in data. The new space is not inited. */ - ptr = memdup(abuf->data, new_size); + ptr = malloc(new_size); if (!ptr) return false; + if (abuf->size) + memcpy(ptr, abuf->data, abuf->size); abuf->data = ptr; abuf->size = new_size; abuf->alloced = true; |