]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix memory leak when initializing DH parameters in backend
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 20 Mar 2021 16:38:22 +0000 (12:38 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 20 Mar 2021 16:38:22 +0000 (12:38 -0400)
commit7d9629ed2f69cd123514e0338cb20afca9abcd59
tree5f309af24967da543106cd30ad05480931c67a06
parentba986b7bc5cf2cc9f586e553f78ab9b2b199fac2
Fix memory leak when initializing DH parameters in backend

When loading DH parameters used for the generation of ephemeral DH keys
in the backend, the code has never bothered releasing the memory used
for the DH information loaded from a file or from libpq's default.  This
commit makes sure that the information is properly free()'d.

Back-patch of e0e569e1d.  We originally thought the leak was minor and
not worth back-patching, but Jelte Fennema pointed out that repeated
SIGHUP's can result in very serious bloat of the postmaster, which is
then multiplied by being duplicated into eadh forked child.

Back-patch to v10; the code looked different before c0a15e07c,
and didn't have a leak in the actually-live code paths.

Michael Paquier

Discussion: https://postgr.es/m/16160-18367e56e9a28264@postgresql.org
src/backend/libpq/be-secure-openssl.c