Content-Length: 257769 | pFad | http://github.com/postgrespro/postgres_cluster/commit/ea8c7e9054abf23fa3de2f8e4414f60ac8a8b620

8B Fix memory leak during regular expression execution. · postgrespro/postgres_cluster@ea8c7e9 · GitHub
Skip to content

Commit ea8c7e9

Browse files
committed
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 5873594. Per report from Sandro Santilli; diagnosis by Greg Stark.
1 parent fb1d92a commit ea8c7e9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/backend/regex/regexec.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ pg_regexec(regex_t *re,
259259
/* clean up */
260260
if (v->pmatch != pmatch && v->pmatch != mat)
261261
FREE(v->pmatch);
262+
n = (size_t) v->g->ntree;
262263
for (i = 0; i < n; i++)
263264
{
264265
if (v->subdfas[i] != NULL)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/ea8c7e9054abf23fa3de2f8e4414f60ac8a8b620

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy