* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.115 2010/01/02 16:57:58 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.116 2010/01/18 02:30:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
ReleaseCachedPlan(portal->cplan, false);
portal->cplan = NULL;
+
+ /*
+ * We must also clear portal->stmts which is now a dangling
+ * reference to the cached plan's plan list. This protects any
+ * code that might try to examine the Portal later.
+ */
+ portal->stmts = NIL;
}
}
(*portal->cleanup) (portal);
/* drop cached plan reference, if any */
- if (portal->cplan)
- PortalReleaseCachedPlan(portal);
+ PortalReleaseCachedPlan(portal);
/*
* Release any resources still attached to the portal. There are several
PersistHoldablePortal(portal);
/* drop cached plan reference, if any */
- if (portal->cplan)
- PortalReleaseCachedPlan(portal);
+ PortalReleaseCachedPlan(portal);
/*
* Any resources belonging to the portal will be released in the
}
/* drop cached plan reference, if any */
- if (portal->cplan)
- PortalReleaseCachedPlan(portal);
+ PortalReleaseCachedPlan(portal);
/*
* Any resources belonging to the portal will be released in the
}
/* drop cached plan reference, if any */
- if (portal->cplan)
- PortalReleaseCachedPlan(portal);
+ PortalReleaseCachedPlan(portal);
/*
* Any resources belonging to the portal will be released in the