From 2ee6529d711925d004fdfec56b8987f94997e69d Mon Sep 17 00:00:00 2001 From: Will Estes Date: Wed, 24 Feb 2016 17:50:00 -0500 Subject: Fixed size of bufferallocation, resolved gh#54. The value of n_alloc was a count, not a size. Multiplying the value by the element size was incorrect. That multiplication was already being done and having it done twice was incorrect. --- src/buf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/buf.c b/src/buf.c index fa713a6..581247c 100644 --- a/src/buf.c +++ b/src/buf.c @@ -242,8 +242,8 @@ struct Buf *buf_append (buf, ptr, n_elem) /* May need to alloc more. */ if (n_elem + buf->nelts > buf->nmax) { - /* exact amount needed... */ - n_alloc = (n_elem + buf->nelts) * buf->elt_size; + /* exact count needed... */ + n_alloc = n_elem + buf->nelts; /* ...plus some extra */ if (((n_alloc * buf->elt_size) % 512) != 0 -- cgit v1.2.3