diff options
author | Will Estes <westes575@gmail.com> | 2016-02-24 17:50:00 -0500 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2016-02-24 17:10:47 -0800 |
commit | 2ee6529d711925d004fdfec56b8987f94997e69d (patch) | |
tree | 62dfa29e47e9b22a17a06c88bf2f7e1660aa4fc0 /src | |
parent | 86ca4f322bbec8f52a76c1bf2a879bf464d9bb65 (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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 |