mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
I have attached the pltcl patch again, just in case. For the sake of clarity
let's say this patch superscedes the previous one. I have also attached a patch addressing the similar memory leak problem in plpython. This includes a slight adjustment of the tests in the source directory. The patch also includes a cosmetic change to remove a compiler warning although I think the change makes the code look worse though. BTW, by my reckoning the memory leak would occur with prepared plans and without. If that is not the case then I've been barking up the wrong tree. Nigel J. Andrews
This commit is contained in:
@ -31,7 +31,7 @@
|
||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.62 2002/09/21 18:39:26 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.63 2002/09/26 05:23:26 momjian Exp $
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
@ -1647,6 +1647,7 @@ pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
|
||||
pltcl_set_tuple_values(interp, arrayname, 0, tuples[0], tupdesc);
|
||||
sprintf(buf, "%d", ntuples);
|
||||
Tcl_SetResult(interp, buf, TCL_VOLATILE);
|
||||
SPI_freetuptable(SPI_tuptable);
|
||||
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
|
||||
return TCL_OK;
|
||||
}
|
||||
@ -1668,15 +1669,19 @@ pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
|
||||
continue;
|
||||
if (loop_rc == TCL_RETURN)
|
||||
{
|
||||
SPI_freetuptable(SPI_tuptable);
|
||||
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
|
||||
return TCL_RETURN;
|
||||
}
|
||||
if (loop_rc == TCL_BREAK)
|
||||
break;
|
||||
SPI_freetuptable(SPI_tuptable);
|
||||
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
SPI_freetuptable(SPI_tuptable);
|
||||
|
||||
/************************************************************
|
||||
* Finally return the number of tuples
|
||||
************************************************************/
|
||||
@ -2207,6 +2212,7 @@ pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
|
||||
{
|
||||
if (ntuples > 0)
|
||||
pltcl_set_tuple_values(interp, arrayname, 0, tuples[0], tupdesc);
|
||||
SPI_freetuptable(SPI_tuptable);
|
||||
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
|
||||
sprintf(buf, "%d", ntuples);
|
||||
Tcl_SetResult(interp, buf, TCL_VOLATILE);
|
||||
@ -2229,15 +2235,19 @@ pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
|
||||
continue;
|
||||
if (loop_rc == TCL_RETURN)
|
||||
{
|
||||
SPI_freetuptable(SPI_tuptable);
|
||||
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
|
||||
return TCL_RETURN;
|
||||
}
|
||||
if (loop_rc == TCL_BREAK)
|
||||
break;
|
||||
SPI_freetuptable(SPI_tuptable);
|
||||
memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
SPI_freetuptable(SPI_tuptable);
|
||||
|
||||
/************************************************************
|
||||
* Finally return the number of tuples
|
||||
************************************************************/
|
||||
|
Reference in New Issue
Block a user