aboutsummaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/buffer.c b/buffer.c
index a3e623d..6763676 100644
--- a/buffer.c
+++ b/buffer.c
@@ -12,13 +12,11 @@ bool buffer_alloc(Buffer *buf, size_t size) {
if (buf->size < size) {
if (buf->size > 0)
size *= 2;
- buf->data = realloc(buf->data, size);
- if (!buf->data) {
- buf->size = 0;
- buf->len = 0;
+ char *data = realloc(buf->data, size);
+ if (!data)
return false;
- }
buf->size = size;
+ buf->data = data;
}
return true;
}