diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-12-08 00:40:27 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-12-08 00:40:27 +0000 |
commit | 566480acbbd37a6a7cb35ae46135e864ac8871a7 (patch) | |
tree | f623658116c0fce237c0e1e9724a2f8c3fbce40e /src/backend/executor | |
parent | 8124215cc39a6c1f15ab8555c9fae4d776b6d9fd (diff) | |
download | postgresql-566480acbbd37a6a7cb35ae46135e864ac8871a7.tar.gz postgresql-566480acbbd37a6a7cb35ae46135e864ac8871a7.zip |
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.
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/spi.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index d4fa794bc3d..90336e4be25 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -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.166 2006/12/08 00:40:27 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); } |