postgresql/src
Tom Lane 82dd1c2714 Fix memory leak in repeated SPGIST index scans.
spgendscan neglected to pfree all the memory allocated by spgbeginscan.
It's possible to get away with that in most normal queries, since the
memory is allocated in the executor's per-query context which is about
to get deleted anyway; but it causes severe memory leakage during
creation or filling of large exclusion-constraint indexes.

Also, document that amendscan is supposed to free what ambeginscan
allocates.  The docs' lack of clarity on that point probably caused this
bug to begin with.  (There is discussion of changing that API spec going
forward, but I don't think it'd be appropriate for the back branches.)

Per report from Bruno Wolff.  It's been like this since the beginning,
so back-patch to all active branches.

In HEAD, also fix an independent leak caused by commit 2a6368343
(allocating memory during spgrescan instead of spgbeginscan, which
might be all right if it got cleaned up, but it didn't).  And do a bit
of code beautification on that commit, too.

Discussion: https://postgr.es/m/20181024012314.GA27428@wolff.to
2018-10-31 17:04:43 -04:00
..
backend Fix memory leak in repeated SPGIST index scans. 2018-10-31 17:04:43 -04:00
bin Support building with Visual Studio 2015 2018-09-11 15:46:35 -04:00
common Unlink static libraries before rebuilding them. 2015-03-01 13:06:39 -05:00
include Back-patch addition of the ALLOCSET_FOO_SIZES macros. 2018-10-12 14:49:33 -04:00
interfaces Reduce an unnecessary O(N^3) loop in lexer. 2018-08-23 21:29:15 +01:00
makefiles Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-07-09 17:23:32 -04:00
pl Still further rethinking of build changes for macOS Mojave. 2018-10-18 14:55:23 -04:00
port Set snprintf.c's maximum number of NL arguments to be 31. 2018-10-02 12:41:28 -04:00
template Still further rethinking of build changes for macOS Mojave. 2018-10-18 14:55:23 -04:00
test Fix minor bug in isolationtester. 2018-10-17 15:06:38 -04:00
timezone Sync our copy of the timezone library with IANA release tzcode2018g. 2018-10-31 09:48:30 -04:00
tools Fix perl searchpath for modern perl for MSVC tools 2018-10-28 12:27:58 -04:00
tutorial Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Still further rethinking of build changes for macOS Mojave. 2018-10-18 14:55:23 -04:00
Makefile.shlib Prevent accidental linking of system-supplied copies of libpq.so etc. 2018-07-09 17:23:32 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00