Re: BUG #16160: Minor memory leak in case of starting postgres server with SSL encryption

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Jelte Fennema <postgres@jeltef.nl>, duspensky@ya.ru, pgsql-bugs@lists.postgresql.org
Date: 2021-03-16T22:22:00Z
Lists: pgsql-bugs
On Tue, Mar 16, 2021 at 11:12:26AM -0700, Andres Freund wrote:
> I wonder if it'd be worth starting to explicitly annotate all the places
> that do allocations and are fine with leaking them. E.g. by introducing
> malloc_permanently() or such. Right now it's hard to use valgrind et al
> to detect leaks because of all the false positives due to such "ok to
> leak" allocations.

Yeah, I have been annoyed by those false positives in the past.  It is
possible to know at quick glance what's wrong once you get used to it,
but anybody running valgrind would be right to be surprised, so having
a different code path for that sounds like a good idea.
--
Michael

Commits

  1. Fix memory leak when rejecting bogus DH parameters.

  2. Fix memory leak when initializing DH parameters in backend

  3. Avoid corner-case memory leak in SSL parameter processing.