Add missing PQclear for StreamLogicalLog function

Started by Steven Niu10 months ago1 messages
#1Steven Niu
niushiji@gmail.com
1 attachment(s)

Hi, hackers,

During browsing the code, I found one missing PQclear in function
StreamLogicalLog(). It's a very small problem as it only happens in
error condition. However since another similar patch was accepted,
maybe we should also fix this one.

/messages/by-id/3DA7CECD-5A05-416D-8527-ABD794AEFE8B@yesql.se

Regards,
Steven

Attachments:

0001-Add-missing-PQclear-for-StreamLogicalLog-function.patchtext/plain; charset=UTF-8; name=0001-Add-missing-PQclear-for-StreamLogicalLog-function.patchDownload
From cc87aec988c483e9118d9d31b1dad1f1ca1fb4e7 Mon Sep 17 00:00:00 2001
From: Steven Niu <niushiji@gmail.com>
Date: Wed, 19 Mar 2025 13:02:18 +0800
Subject: Add missing PQclear for StreamLogicalLog function

---
 src/bin/pg_basebackup/pg_recvlogical.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin/pg_basebackup/pg_recvlogical.c b/src/bin/pg_basebackup/pg_recvlogical.c
index b9ea23e1426..b68f8b82b92 100644
--- a/src/bin/pg_basebackup/pg_recvlogical.c
+++ b/src/bin/pg_basebackup/pg_recvlogical.c
@@ -633,6 +633,7 @@ StreamLogicalLog(void)
 	{
 		pg_log_error("unexpected termination of replication stream: %s",
 					 PQresultErrorMessage(res));
+		PQclear(res);
 		goto error;
 	}
 	PQclear(res);
-- 
2.43.0