Re: memory leak in dbase_redo()

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: memory leak in dbase_redo()
Date: 2025-10-09 16:36:58
Message-ID: 202510091618.unaukimc42ky@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Oct-09, Nathan Bossart wrote:

> It looks like this was introduced by commit 9e4f914, which was
> back-patched, but the code path in question first appears in v15. So,
> presumably something like the following needs to be back-patched that far.
> I can take care of it unless someone else wants it.

Hmm, it's my bug, please let me get it done.

> diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
> index 2793fd83771..4d65e8c46c2 100644
> --- a/src/backend/commands/dbcommands.c
> +++ b/src/backend/commands/dbcommands.c
> @@ -3375,6 +3375,7 @@ dbase_redo(XLogReaderState *record)
> parent_path = pstrdup(dbpath);
> get_parent_directory(parent_path);
> recovery_create_dbdir(parent_path, true);
> + pfree(parent_path);

Yeah, this LGTM.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-10-09 16:50:53 Re: Adding some error context for lock wait failures
Previous Message Nathan Bossart 2025-10-09 16:33:29 Re: another autovacuum scheduling thread