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
*/
if (portalIsProducing(portal))
return;
+
+ if (portal->queryDesc)
+ {
+ ResourceOwner saveResourceOwner = CurrentResourceOwner;
+ CurrentResourceOwner = portal->resowner;
+ FreeQueryDesc(portal->queryDesc);
+ CurrentResourceOwner = saveResourceOwner;
+ portal->queryDesc = NULL;
+ }
#endif
/*