commit 0aae500e2f4f83509a8bf9bfad1799eb20a43d13
parent e580e6678ecc8683f9b6fc3bee0ca3bcbb89e9fa
Author: Joris Vink <joris@coders.se>
Date: Sat, 9 Jan 2016 13:40:15 +0100
Merge pull request #101 from CarlEkerot/ce-buf-append-fix
Don't reallocate a buffer if we do not need to.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/buf.c b/src/buf.c
@@ -32,7 +32,7 @@ kore_buf_create(u_int32_t initial)
void
kore_buf_append(struct kore_buf *buf, const void *d, u_int32_t len)
{
- if ((buf->offset + len) >= buf->length) {
+ if ((buf->offset + len) > buf->length) {
buf->length += len + KORE_BUF_INCREMENT;
buf->data = kore_realloc(buf->data, buf->length);
}