nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 49ca7e5aa8033798d6e678b451fc465c143f3491
parent be9b1a188737c3cf5b08b875f2e4153ee5a47446
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri,  5 Mar 2021 11:16:18 +0100

memory: do not allocate space for multidata when it's already allocated

Allocating it again would leak the existing space.

This fixes https://savannah.gnu.org/bugs/?60172.
Reported-by: Mike Frysinger <vapier@gentoo.org>

Bug existed since version 5.6, commit 1fdd23d3.

Diffstat:
Msrc/color.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/color.c b/src/color.c @@ -305,7 +305,8 @@ void precalc_multicolorinfo(void) /* For each line, allocate cache space for the multiline-regex info. */ for (line = openfile->filetop; line != NULL; line = line->next) - line->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short)); + if (!line->multidata) + line->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short)); for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) { /* If this is not a multi-line regex, skip it. */