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.
master
Benno Schulenberg 2021-03-05 18:43:43 +01:00
parent 49ca7e5aa8
commit f6357a73f0
1 changed files with 1 additions and 1 deletions

View File

@ -951,7 +951,7 @@ void discard_until(const undostruct *thisitem)
while (group != NULL) { while (group != NULL) {
groupstruct *next = group->next; groupstruct *next = group->next;
free_chararray(group->indentations, free_chararray(group->indentations,
group->bottom_line - group->top_line); group->bottom_line - group->top_line + 1);
free(group); free(group);
group = next; group = next;
} }