postgresql/contrib/postgres_fdw
Andres Freund 88e6ad3054 Fix two memory leaks around force-storing tuples in slots.
As reported by Tom, when ExecStoreMinimalTuple() had to perform a
conversion to store the minimal tuple in the slot, it forgot to
respect the shouldFree flag, and leaked the tuple into the current
memory context if true.  Fix that by freeing the tuple in that case.

Looking at the relevant code made me (Andres) realize that not having
the shouldFree parameter to ExecForceStoreHeapTuple() was a bad
idea. Some callers had to locally implement the necessary logic, and
in one case it was missing, creating a potential per-group leak in
non-hashed aggregation.

The choice to not free the tuple in ExecComputeStoredGenerated() is
not pretty, but not introduced by this commit - I'll start a separate
discussion about it.

Reported-By: Tom Lane
Discussion: https://postgr.es/m/366.1555382816@sss.pgh.pa.us
2019-04-19 11:39:56 -07:00
..
expected Add support TCP user timeout in libpq and the backend server 2019-04-06 15:23:37 +09:00
sql Add support TCP user timeout in libpq and the backend server 2019-04-06 15:23:37 +09:00
.gitignore Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
Makefile Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-04-03 16:26:05 -04:00
connection.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
deparse.c postgres_fdw: Perform the (FINAL, NULL) upperrel operations remotely. 2019-04-02 20:30:45 +09:00
option.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
postgres_fdw--1.0.sql Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw.c Fix two memory leaks around force-storing tuples in slots. 2019-04-19 11:39:56 -07:00
postgres_fdw.control Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw.h postgres_fdw: Perform the (FINAL, NULL) upperrel operations remotely. 2019-04-02 20:30:45 +09:00
shippable.c Update copyright for 2019 2019-01-02 12:44:25 -05:00