From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix SPI error cleanup and memory leak |
Date: | 2018-05-03 12:43:07 |
Message-ID: | E1fEDZj-0006Mg-I8@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix SPI error cleanup and memory leak
Since the SPI stack has been moved from TopTransactionContext to
TopMemoryContext, setting _SPI_stack to NULL in AtEOXact_SPI() leaks
memory. In fact, we don't need to do that anymore: We just leave the
allocated stack around for the next SPI use.
Also, refactor the SPI cleanup so that it is run both at transaction end
and when returning to the main loop on an exception. The latter is
necessary when a procedure calls a COMMIT or ROLLBACK command that
itself causes an error.
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/30c66e77be1d890c3cca766259c0bec80bcac1b5
Modified Files
--------------
src/backend/executor/spi.c | 30 ++++++++++++++++--------------
src/backend/tcop/postgres.c | 2 ++
src/include/executor/spi.h | 1 +
3 files changed, 19 insertions(+), 14 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2018-05-03 13:36:17 | Re: pgsql: Clean up warnings from -Wimplicit-fallthrough. |
Previous Message | Glyn Astill | 2018-05-03 10:05:09 | Re: pgsql: Test conversion of NaN between float4 and float8. |