mirror of
https://github.com/postgres/postgres.git
synced 2026-03-25 11:56:13 -04:00
Fix memory leak during regular expression execution.
For a regex containing backrefs, pg_regexec() might fail to free all the
sub-DFAs that were created during execution, resulting in a permanent
(session lifespan) memory leak. Problem was introduced by me in commit
587359479a. Per report from Sandro Santilli;
diagnosis by Greg Stark.
This commit is contained in:
parent
fb1d92a9fa
commit
ea8c7e9054
1 changed files with 1 additions and 0 deletions
|
|
@ -259,6 +259,7 @@ pg_regexec(regex_t *re,
|
|||
/* clean up */
|
||||
if (v->pmatch != pmatch && v->pmatch != mat)
|
||||
FREE(v->pmatch);
|
||||
n = (size_t) v->g->ntree;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
if (v->subdfas[i] != NULL)
|
||||
|
|
|
|||
Loading…
Reference in a new issue