Re: Fixing memory leaks in postgres_fdw

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matheus Alcantara <matheusssilv97@gmail.com>
Cc: Etsuro Fujita <etsuro.fujita@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-05-30T18:31:54Z
Lists: pgsql-hackers

Attachments

Matheus Alcantara <matheusssilv97@gmail.com> writes:
> Sounds reasonable to me. +1 for going forward with these patches.

I got cold feet about applying the full patchset to v18 --- it's
kind of a large change and it's not fixing any known bug that the
minimal patch doesn't, so it feels like something not to do after
beta1.  So I pushed the minimal patch in all branches.  Here is
a rebased-on-top-of-that version of the full patchset, which
I plan to push once v19 development opens.

			regards, tom lane

Commits

  1. Silence leakage complaint about postgres_fdw's InitPgFdwOptions.

  2. Run pgindent on the changes of the previous patch.

  3. Reap the benefits of not having to avoid leaking PGresults.

  4. Create infrastructure to reliably prevent leakage of PGresults.

  5. Fix memory leakage in postgres_fdw's DirectModify code path.

  6. Avoid resource leaks when a dblink connection fails.