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.
This commit is contained in:
Benno Schulenberg 2021-03-05 11:16:18 +01:00
parent be9b1a1887
commit 49ca7e5aa8
1 changed files with 2 additions and 1 deletions

View File

@ -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. */