From e33379bab95031555ed5459ee8a73672f24fd0a0 Mon Sep 17 00:00:00 2001 From: pommicket Date: Wed, 13 Sep 2023 23:02:40 -0400 Subject: fix use-after-free which broke LSP sync --- buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- cgit v1.2.3