From 54d23601b978d2552696fb7fe35ae5d6102ea2cb Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 5 Mar 2025 07:56:03 +0900 Subject: [PATCH] psql: Fix memory leak with \gx used within a pipeline While inside a pipeline, \gx is currently forbidden and will make exec_command_g() exit early. There was a memory leak in this code path, so let's fix it. Author: Anthonin Bonnefoy Discussion: https://postgr.es/m/CAO6_XqqFVQjLjZQiL7xdwLpzZEy1ghO_JWvCFPM_OmwF9s7XdA@mail.gmail.com --- src/bin/psql/command.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 0f27bf7a91f..fb0b27568c5 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -1739,6 +1739,7 @@ exec_command_g(PsqlScanState scan_state, bool active_branch, const char *cmd) { pg_log_error("\\gx not allowed in pipeline mode"); clean_extended_state(); + free(fname); return PSQL_CMD_ERROR; } -- 2.30.2