Re: [PATCH] Fix memory leak of primary_sysid in walreceiver

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: DaeMyung Kang <charsyam(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Fix memory leak of primary_sysid in walreceiver
Date: 2026-04-27 00:36:55
Message-ID: ae6vp9L-GUb0ERTF@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-04-27 00:46:02 Re: [PATCH] Fix memory leak of reply_message in walreceiver
Previous Message Daniel Gustafsson 2026-04-26 22:01:03 Re: Separators in pg_hosts.conf fields