Re: pg_upgrade: fix memory leak in SLRU I/O code - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pg_upgrade: fix memory leak in SLRU I/O code
Date
Msg-id aYQqllw9Rjq5lfLX@paquier.xyz
Whole thread Raw
In response to Re: pg_upgrade: fix memory leak in SLRU I/O code  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: pg_upgrade: fix memory leak in SLRU I/O code
List pgsql-hackers
On Thu, Feb 05, 2026 at 01:02:08PM +0800, Chao Li wrote:
> My concern is more about the pattern: freeing the container
> structure while leaving its members allocated. That feels
> inconsistent and potentially confusing to readers. Either owning
> objects should be fully freed, or not freed at all, but partial
> freeing doesn’t seem like a great precedent. I’m not sure that’s a
> pattern we want to encourage in PG code.

For one-time allocations that are freed once we exit the binary, I
would not have bothered about freeing the state, TBH.  Closing the fd
in these two paths is a good thing, though.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Ajin Cherian
Date:
Subject: Re: [PATCH] Support automatic sequence replication
Next
From: Shlok Kyal
Date:
Subject: Re: Skipping schema changes in publication