]> granicus.if.org Git - postgresql/commit
PL/Python: Fix potential NULL pointer dereference
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 5 Dec 2017 19:14:55 +0000 (14:14 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 13 Dec 2017 01:52:14 +0000 (20:52 -0500)
commit4c6744ed705df6f388371d044b87d1b4a60e9f80
treeb88bb007b6fab8af6192417d2099fe601f7484c2
parent85abb5b297c5b318738f09345ae226f780b88e92
PL/Python: Fix potential NULL pointer dereference

After d0aa965c0a0ac2ff7906ae1b1dad50a7952efa56, one error path in
PLy_spi_execute_fetch_result() could result in the variable "result"
being dereferenced after being set to NULL.  Rearrange the code a bit to
fix that.

Also add another SPI_freetuptable() call so that that is cleared in all
error paths.

discovered by John Naylor <jcnaylor@gmail.com> via scan-build

ideas and review by Tom Lane
src/pl/plpython/plpy_spi.c