mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Avoid double free of _SPI_current->tuptable. AtEOSubXact_SPI() now tries to
release it in a subtransaction abort, but this neglects possibility that someone outside SPI already did. Fix is for spi.c to forget about a tuptable as soon as it's handed it back to the caller. Per bug #2817 from Michael Andreen.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.165 2006/11/21 22:35:29 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.165.2.1 2006/12/08 00:40:33 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1543,6 +1543,9 @@ fail:
|
||||
SPI_lastoid = my_lastoid;
|
||||
SPI_tuptable = my_tuptable;
|
||||
|
||||
/* tuptable now is caller's responsibility, not SPI's */
|
||||
_SPI_current->tuptable = NULL;
|
||||
|
||||
return my_res;
|
||||
}
|
||||
|
||||
@ -1695,6 +1698,9 @@ _SPI_cursor_operation(Portal portal, bool forward, long count,
|
||||
SPI_processed = _SPI_current->processed;
|
||||
SPI_tuptable = _SPI_current->tuptable;
|
||||
|
||||
/* tuptable now is caller's responsibility, not SPI's */
|
||||
_SPI_current->tuptable = NULL;
|
||||
|
||||
/* Pop the SPI stack */
|
||||
_SPI_end_call(true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user