Cygwin: regex: fix freeing g->charjump in low memory condition

computejumps() moves g->charjump to a position relativ to the value of
CHAR_MIN.  As such, g->charjump doesn't necessarily point to the address
actually allocated.  While regfree() takes that into account, the low
memory handling in regcomp_internal() doesn't.  Fix that by free'ing
the actually allocated address, as in regfree().

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2023-03-16 21:52:48 +01:00
parent 271292b1fb
commit e914374383
1 changed files with 1 additions and 1 deletions

View File

@ -336,7 +336,7 @@ regcomp_internal(regex_t * __restrict preg,
computejumps(p, g);
computematchjumps(p, g);
if(g->matchjump == NULL && g->charjump != NULL) {
free(g->charjump);
free(&g->charjump[CHAR_MIN]);
g->charjump = NULL;
}
}