pgsql: PL/Python: Fix crash in functions returning SETOF and using SPI

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема pgsql: PL/Python: Fix crash in functions returning SETOF and using SPI
Дата
Msg-id E1SPdus-0005vg-0R@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
PL/Python: Fix crash in functions returning SETOF and using SPI

Allocate PLyResultObject.tupdesc in TopMemoryContext, because its
lifetime is the lifetime of the Python object and it shouldn't be
freed by some other memory context, such as one controlled by SPI.  We
trust that the Python object will clean up its own memory.

Before, this would crash the included regression test case by trying
to use memory that was already freed.

reported by Asif Naeem, analysis by Tom Lane

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/52aa334fcd5a9d230be7e8fb964d94c6c4e63dc7

Modified Files
--------------
src/pl/plpython/expected/plpython_setof.out |   16 ++++++++++++++++
src/pl/plpython/plpy_spi.c                  |   11 +++++++++++
src/pl/plpython/sql/plpython_setof.sql      |   12 ++++++++++++
3 files changed, 39 insertions(+), 0 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Even more duplicate word removal, in the spirit of the season
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: PL/Python: Improve test coverage