b6b438
From aa688caadf30b5f212e2b5614a62268946174888 Mon Sep 17 00:00:00 2001
b6b438
From: Volker Lendecke <vl@samba.org>
b6b438
Date: Tue, 19 Nov 2019 14:20:14 +0100
b6b438
Subject: [PATCH 161/187] winbind: Fix CID 1455915 Resource leak
b6b438
b6b438
Signed-off-by: Volker Lendecke <vl@samba.org>
b6b438
Reviewed-by: Andreas Schneider <asn@samba.org>
b6b438
(cherry picked from commit b9e74928ab99a169c76dcd3b401da70cbd1b3985)
b6b438
---
b6b438
 source3/winbindd/winbindd_cache.c | 3 +++
b6b438
 1 file changed, 3 insertions(+)
b6b438
b6b438
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
b6b438
index 3e7afdaa546..9122e2bc5d6 100644
b6b438
--- a/source3/winbindd/winbindd_cache.c
b6b438
+++ b/source3/winbindd/winbindd_cache.c
b6b438
@@ -1392,17 +1392,20 @@ NTSTATUS wcache_save_creds(struct winbindd_domain *domain,
b6b438
 
b6b438
 	rc = gnutls_hash_init(&hash_hnd, GNUTLS_DIG_MD5);
b6b438
 	if (rc < 0) {
b6b438
+		centry_free(centry);
b6b438
 		return gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
b6b438
 	}
b6b438
 
b6b438
 	rc = gnutls_hash(hash_hnd, cred_salt, 16);
b6b438
 	if (rc < 0) {
b6b438
 		gnutls_hash_deinit(hash_hnd, NULL);
b6b438
+		centry_free(centry);
b6b438
 		return gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
b6b438
 	}
b6b438
 	rc = gnutls_hash(hash_hnd, nt_pass, 16);
b6b438
 	if (rc < 0) {
b6b438
 		gnutls_hash_deinit(hash_hnd, NULL);
b6b438
+		centry_free(centry);
b6b438
 		return gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
b6b438
 	}
b6b438
 	gnutls_hash_deinit(hash_hnd, salted_hash);
b6b438
-- 
b6b438
2.23.0
b6b438