Re: [PATCH] Fix memory leak of primary_sysid in walreceiver - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [PATCH] Fix memory leak of primary_sysid in walreceiver
Date
Msg-id ae6vp9L-GUb0ERTF@paquier.xyz
Whole thread
In response to [PATCH] Fix memory leak of primary_sysid in walreceiver  (DaeMyung Kang <charsyam@gmail.com>)
List pgsql-hackers
On Mon, Apr 27, 2026 at 02:01:30AM +0900, DaeMyung Kang wrote:
> The attached patch adds a pfree(primary_sysid) right after the
> comparison.

My first impression was that it does not matter because I was under
the impression that this code path is only reached once, but that's
not the case: a WAL receiver could stay around waiting for
instructions before retrying a connection.

I doubt that this is worth bothering for in the back branches, as it
just means a small leak each time we switch to a new TLI repeatedly,
something that would matter mostly for a cascading standby where we
don't want to change the connection point (a SIGHUP'd primary_conninto
enforces a WAL receiver shutdown).  Let's clean up on HEAD, though.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Separators in pg_hosts.conf fields
Next
From: Michael Paquier
Date:
Subject: Re: [PATCH] Fix memory leak of reply_message in walreceiver