diff options
author | Will Estes <westes575@gmail.com> | 2016-02-24 17:50:00 -0500 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2016-02-24 17:50:00 -0500 |
commit | d2a67ba6b76630610cffb292692b3ef4767274b4 (patch) | |
tree | b24e82dcb24e39624100fb5a5d6e16996bb547f1 /src/buf.c | |
parent | dcf0226b06289a468578ba9a68f67c73bbcdd7c7 (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/buf.c')
-rw-r--r-- | src/buf.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -237,8 +237,8 @@ struct Buf *buf_append (struct Buf *buf, const void *ptr, int 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 |