v01-0001-Fix-fname-leak-on-gx-within-a-pipeline.patch
application/octet-stream
Filename: v01-0001-Fix-fname-leak-on-gx-within-a-pipeline.patch
Type: application/octet-stream
Part: 0
Message:
Re: Add Pipelining support in psql
From 8286539d24698b13f283a9faef6f2aec3093e75a Mon Sep 17 00:00:00 2001
From: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Date: Tue, 4 Mar 2025 09:04:31 +0100
Subject: Fix fname leak on \gx within a pipeline
While inside a pipeline, \gx is forbidden and will make exec_command_g
exit early. If a filename parameter was provided, the allocated fname
currently isn't freed.
This patch adds the missing free when this happens.
---
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.39.5 (Apple Git-154)