Fix memory leak in ARRAY(SELECT ...) subqueries.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: d8bd584bf4cc6c74178a73ae8924b86ab2bebb44
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2012-06-21T21:26:24Z
Releases: 9.0.9
Fix memory leak in ARRAY(SELECT ...) subqueries.

Repeated execution of an uncorrelated ARRAY_SUBLINK sub-select (which
I think can only happen if the sub-select is embedded in a larger,
correlated subquery) would leak memory for the duration of the query,
due to not reclaiming the array generated in the previous execution.
Per bug #6698 from Armando Miraglia.  Diagnosis and fix idea by Heikki,
patch itself by me.

This has been like this all along, so back-patch to all supported versions.

Files

PathChange+/−
src/backend/executor/nodeSubplan.c modified +13 −5
src/include/nodes/execnodes.h modified +1 −0