Re: Missing list_free in publicationcmds.c:OpenTableList

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: surya poondla <suryapoondla4(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "zhong950419(at)gmail(dot)com" <zhong950419(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: Missing list_free in publicationcmds.c:OpenTableList
Date: 2026-08-10 23:20:39
Message-ID: CAHut+Puc4r2E1E8ZExgjHW=0q=Zj-oiA-i+huF+hp+baJp+eXQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 11, 2026 at 8:20 AM surya poondla <suryapoondla4(at)gmail(dot)com> wrote:
>
> Hi Peter,
>
> +1 for v2, I confirmed the premise: OpenTableList() is only reached from CreatePublication() and AlterPublicationTables(), i.e. once
> per DDL statement, with the lists allocated in the command's context.
>

Thanks for your review!

> Can you add a comment before the return something like
> /*
> * relids, relids_with_rf and relids_with_collist are deliberately not
> * freed here. This function runs at most once per DDL command, the
> * surrounding command-lifetime memory context frees them later.
> */
> So future readers will not think of it as a bug.
> This is only a suggestion, feel free to skip it if you'd rather keep the patch minimal.
>

Fair enough. TBH I'm not sure if comments like this are usual
practice, but I did find a couple of similar examples, so I've added a
comment to v3 as suggested, and a committer can decide to keep it or
not.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v3-0001-Remove-unnecessary-list_free.patch application/octet-stream 860 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-08-10 23:46:20 Re: [PATCH] Fix TOCTOU races in recovery/t/020_archive_status.pl archive checks
Previous Message Tom Lane 2026-08-10 23:00:06 Re: Introduce psystem() to replace system()