Index: src/pl/plpython/plpython.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/pl/plpython/plpython.c,v retrieving revision 1.25 diff -c -r1.25 plpython.c *** src/pl/plpython/plpython.c 2002/10/14 04:20:52 1.25 --- src/pl/plpython/plpython.c 2002/10/19 20:25:34 *************** *** 1837,1857 **** enter(); if (ob->plan) ! { ! /* ! * free the plan... pfree(ob->plan); ! * ! * FIXME -- leaks saved plan on object destruction. can this be ! * avoided? ! * I think so. A function prepares and then execp's a statement. ! * When we come to deallocate the 'statement' object we obviously ! * no long need the plan. Even if we did, without the object ! * we're never going to be able to use it again. ! * In the against arguments: SPI_saveplan has stuck this under ! * the top context so there must be a reason for doing that. ! */ ! pfree(ob->plan); ! } if (ob->types) PLy_free(ob->types); if (ob->args) --- 1837,1844 ---- enter(); if (ob->plan) ! SPI_freeplan(ob->plan); ! if (ob->types) PLy_free(ob->types); if (ob->args) *************** *** 2023,2028 **** --- 2010,2016 ---- PyObject *list = NULL; PyObject *volatile optr = NULL; char *query; + void *spiplan; enter(); *************** *** 2062,2068 **** int nargs, i; - nargs = PySequence_Length(list); if (nargs > 0) { --- 2050,2055 ---- *************** *** 2125,2131 **** RAISE_EXC(1); } ! plan->plan = SPI_saveplan(plan->plan); if (plan->plan == NULL) { PLy_exception_set(PLy_exc_spi_error, --- 2112,2119 ---- RAISE_EXC(1); } ! plan->plan = SPI_saveplan(spiplan = plan->plan); ! SPI_freeplan(spiplan); if (plan->plan == NULL) { PLy_exception_set(PLy_exc_spi_error,