From 079a646f4db6ff80ec02a6bb8884f4c5b075345c Mon Sep 17 00:00:00 2001
From: Aleksander Alekseev <aleksander@tigerdata.com>
Date: Thu, 12 Mar 2026 14:53:38 +0300
Subject: [PATCH v1] Free memory allocated for unrecognized_protocol_options

Since 4966bd3ed95e Valgrind started to warn about little amount of memory being
leaked in ProcessStartupPacket(). This is not critical but the warnings may
distract from real issues. Fix it by freeing the list after use.

Author: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: TODO FIXME
Discussion: TODO FIXME
---
 src/backend/tcop/backend_startup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/backend/tcop/backend_startup.c b/src/backend/tcop/backend_startup.c
index c517115927c..5abf276c898 100644
--- a/src/backend/tcop/backend_startup.c
+++ b/src/backend/tcop/backend_startup.c
@@ -825,6 +825,8 @@ ProcessStartupPacket(Port *port, bool ssl_done, bool gss_done)
 		if (PG_PROTOCOL_MINOR(proto) > PG_PROTOCOL_MINOR(PG_PROTOCOL_LATEST) ||
 			unrecognized_protocol_options != NIL)
 			SendNegotiateProtocolVersion(unrecognized_protocol_options);
+
+		list_free_deep(unrecognized_protocol_options);
 	}
 
 	/* Check a user name was given. */
-- 
2.43.0

