From bc523197ecbfc094455287d9eb036a2727bca684 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Wed, 15 Feb 2023 23:51:25 +0100 Subject: Fix double free --- src/buffer.c | 4 ---- src/text.c | 1 - 2 files changed, 5 deletions(-) (limited to 'src') diff --git a/src/buffer.c b/src/buffer.c index 5cdc22b..0b67c88 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -297,10 +297,6 @@ struct text_chunk *copy_region(struct buffer *buffer, struct region region) { if (curr->allocated) { free(curr->text); - curr->text = NULL; - curr->nbytes = curr->nchars = 0; - curr->line = 0; - curr->allocated = false; } struct text_chunk txt = diff --git a/src/text.c b/src/text.c index 115fb13..2ecd137 100644 --- a/src/text.c +++ b/src/text.c @@ -241,7 +241,6 @@ void delete_line(struct text *text, uint32_t line) { } --text->nlines; - free(text->lines[text->nlines].data); text->lines[text->nlines].data = NULL; text->lines[text->nlines].nbytes = 0; text->lines[text->nlines].nchars = 0; -- cgit v1.2.3