aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2025-03-05 07:56:03 +0900
committerMichael Paquier <michael@paquier.xyz>2025-03-05 07:56:03 +0900
commit54d23601b978d2552696fb7fe35ae5d6102ea2cb (patch)
treebeb94e61dd72eab7448a24128a6df149cd0eeba0 /src
parentb229c10164770769c3b5033785917ca7a43a2471 (diff)
downloadpostgresql-54d23601b978d2552696fb7fe35ae5d6102ea2cb.tar.gz
postgresql-54d23601b978d2552696fb7fe35ae5d6102ea2cb.zip
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 <anthonin.bonnefoy@datadoghq.com> Discussion: https://postgr.es/m/CAO6_XqqFVQjLjZQiL7xdwLpzZEy1ghO_JWvCFPM_OmwF9s7XdA@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/command.c1
1 files changed, 1 insertions, 0 deletions
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;
}