commit f6357a73f0df80c112f99265b9edb032dbf3c34d
parent 49ca7e5aa8033798d6e678b451fc465c143f3491
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 5 Mar 2021 18:43:43 +0100
memory: fix an off-by-one error to free also the last line in a group
The number of lines in a group is the difference in line numbers
between the last line and the first line *plus one*.
This fixes https://savannah.gnu.org/bugs/?60104.
Bug existed since version 2.9.0, since indenting and unindenting
became undoable, and commit f722c532 formed a part of that.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/text.c b/src/text.c
@@ -951,7 +951,7 @@ void discard_until(const undostruct *thisitem)
while (group != NULL) {
groupstruct *next = group->next;
free_chararray(group->indentations,
- group->bottom_line - group->top_line);
+ group->bottom_line - group->top_line + 1);
free(group);
group = next;
}