summary refs log tree commit diff
path: root/bin/edi
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/edi/buffer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bin/edi/buffer.c b/bin/edi/buffer.c
index e15ae20d..7297f411 100644
--- a/bin/edi/buffer.c
+++ b/bin/edi/buffer.c
@@ -75,8 +75,9 @@ void bufferDelete(struct Buffer *buf) {
 wchar_t *bufferDest(struct Buffer *buf, size_t len) {
 	if (buf->len + len > buf->cap) {
 		if (!buf->len) {
+			struct Block *empty = buf->block;
 			buf->block = buf->block->prev;
-			free(buf->block);
+			free(empty);
 		}
 		while (len > buf->cap) buf->cap *= 2;
 		buf->block = blockAlloc(buf->block, buf->cap);