aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeHashjoin.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-02-02 13:49:08 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2021-02-02 13:49:08 -0500
commit7428469586e837747f86566c790f6ccceac1b1f3 (patch)
treea5c4a9e51f1999e799c1c61c4b2abbde423066ce /src/backend/executor/nodeHashjoin.c
parentbe843ce29737ee4752fedabe07a75cf9db1e969f (diff)
downloadpostgresql-7428469586e837747f86566c790f6ccceac1b1f3.tar.gz
postgresql-7428469586e837747f86566c790f6ccceac1b1f3.zip
Fix ancient memory leak in contrib/auto_explain.
The ExecutorEnd hook is invoked in a context that could be quite long-lived, not the executor's own per-query context as I think we were sort of assuming. Thus, any cruft generated while producing the EXPLAIN output could accumulate over multiple queries. This can result in spectacular leakage if log_nested_statements is on, and even without that I'm surprised nobody complained before. To fix, just switch into the executor's context so that anything we allocate will be released when standard_ExecutorEnd frees the executor state. We might as well nuke the code's retail pfree of the explain output string, too; that's laughably inadequate to the need. Japin Li, per report from Jeff Janes. This bug is old, so back-patch to all supported branches. Discussion: https://postgr.es/m/CAMkU=1wCVtbeRn0s9gt12KwQ7PLXovbpM8eg25SYocKW3BT4hg@mail.gmail.com
Diffstat (limited to 'src/backend/executor/nodeHashjoin.c')
0 files changed, 0 insertions, 0 deletions