summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWill Estes <westes575@gmail.com>2016-02-24 17:50:00 -0500
committerManoj Srivastava <srivasta@debian.org>2016-02-24 17:10:47 -0800
commit2ee6529d711925d004fdfec56b8987f94997e69d (patch)
tree62dfa29e47e9b22a17a06c88bf2f7e1660aa4fc0 /src
parent86ca4f322bbec8f52a76c1bf2a879bf464d9bb65 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/buf.c4
1 files 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