mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 04:43:53 +00:00
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(). MFC After: 2 weeks Reviewed by: imp,jrtc27 Pull Request: https://github.com/freebsd/freebsd-src/pull/692
This commit is contained in:
parent
4b1d3a3091
commit
619f455b8f
|
@ -321,7 +321,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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue