From 9add1bbfa6659f45eb70f19961ce88973801b8ed Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Mon, 9 Dec 2024 20:58:23 +0100 Subject: [PATCH] Fix small memory leaks in GUC checks Follow-up commit to a9d58bfe8a3a. Backpatch down to v16 where this was added in order to keep the code consistent for future backpatches. Author: Tofig Aliev Reviewed-by: Daniel Gustafsson Reviewed-by: Masahiko Sawada Discussion: https://postgr.es/m/bba4313fdde9db46db279f96f3b748b1@postgrespro.ru Backpatch-through: 16 --- src/backend/commands/variable.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index 61eae295fa8..f92d72b5b7e 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -1082,6 +1082,8 @@ check_application_name(char **newval, void **extra, GucSource source) return false; } + guc_free(*newval); + pfree(clean); *newval = ret; return true; @@ -1118,6 +1120,8 @@ check_cluster_name(char **newval, void **extra, GucSource source) return false; } + guc_free(*newval); + pfree(clean); *newval = ret; return true;