summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2015-08-18 11:36:23 +0000
committerPavan Deolasee2015-08-18 11:36:23 +0000
commitf58df0f5928628b88c4d5152828a1a3a474e34c8 (patch)
tree5d467a543d3bbf542ceebb2d40532a12fc53cf63
parent724673cad46cb288b9ab66382be57b74119817b3 (diff)
Free queryDesc while dropping a portal.
Once we decide that the portal is no longer an active producing portal, we decide to release all resources. But before that we must free the queryDesc and unregister any snapshots to avoid snapshot-leak warnings later on
-rw-r--r--src/backend/utils/mmgr/portalmem.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c
index b1e1dc935e..2880b2c728 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -584,6 +584,15 @@ PortalDrop(Portal portal, bool isTopCommit)
*/
if (portalIsProducing(portal))
return;
+
+ if (portal->queryDesc)
+ {
+ ResourceOwner saveResourceOwner = CurrentResourceOwner;
+ CurrentResourceOwner = portal->resowner;
+ FreeQueryDesc(portal->queryDesc);
+ CurrentResourceOwner = saveResourceOwner;
+ portal->queryDesc = NULL;
+ }
#endif
/*