From d7bcdfa6b88d639c6d8c4352722b432d93fdb328 Mon Sep 17 00:00:00 2001
From: Andrew Walker <awalker@ixsystems.com>
Date: Fri, 2 Sep 2022 16:31:32 -0400
Subject: [PATCH] nsswitch:libwbclient - fix leak in wbcCtxPingDc2

Memory allocated for response is never freed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15164

Signed-off-by: Andrew Walker <awalker@ixsystems.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Sep  6 20:10:17 UTC 2022 on sn-devel-184

(cherry picked from commit aa9f3a2da97ae13cce3e50fe3d58f143200e9a17)
---
 nsswitch/libwbclient/wbc_pam.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nsswitch/libwbclient/wbc_pam.c b/nsswitch/libwbclient/wbc_pam.c
index b4bb2678ad0..4df0ffe2eb5 100644
--- a/nsswitch/libwbclient/wbc_pam.c
+++ b/nsswitch/libwbclient/wbc_pam.c
@@ -731,6 +731,7 @@ wbcErr wbcCtxPingDc2(struct wbcContext *ctx, const char *domain,
 	BAIL_ON_WBC_ERROR(wbc_status);
 
  done:
+	winbindd_free_response(&response);
 	return wbc_status;
 }