summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-13 23:02:40 -0400
committerpommicket <pommicket@gmail.com>2023-09-13 23:02:40 -0400
commite33379bab95031555ed5459ee8a73672f24fd0a0 (patch)
treef3c99c467eaf841685d6cdc478e1bdcfedb22c4c /buffer.c
parentdfe82ad946c0d87ba533f8f0b57c1e969125c97a (diff)
fix use-after-free which broke LSP sync
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index f4370ef..d840547 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2078,7 +2078,6 @@ BufferPos buffer_insert_text_at_pos(TextBuffer *buffer, BufferPos pos, String32
buffer_lines_modified(buffer, pos.line, line_idx);
BufferPos b = {.line = line_idx, .index = index};
- free(str_alloc);
// we need to do this *after* making the change to the buffer
// because of how non-incremental syncing works.
@@ -2103,6 +2102,7 @@ BufferPos buffer_insert_text_at_pos(TextBuffer *buffer, BufferPos pos, String32
n->fn(n->context, buffer, &info);
}
+ free(str_alloc);
return b;
}