Blob Blame History Raw
From aa688caadf30b5f212e2b5614a62268946174888 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@samba.org>
Date: Tue, 19 Nov 2019 14:20:14 +0100
Subject: [PATCH 161/187] winbind: Fix CID 1455915 Resource leak

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit b9e74928ab99a169c76dcd3b401da70cbd1b3985)
---
 source3/winbindd/winbindd_cache.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index 3e7afdaa546..9122e2bc5d6 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -1392,17 +1392,20 @@ NTSTATUS wcache_save_creds(struct winbindd_domain *domain,
 
 	rc = gnutls_hash_init(&hash_hnd, GNUTLS_DIG_MD5);
 	if (rc < 0) {
+		centry_free(centry);
 		return gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
 	}
 
 	rc = gnutls_hash(hash_hnd, cred_salt, 16);
 	if (rc < 0) {
 		gnutls_hash_deinit(hash_hnd, NULL);
+		centry_free(centry);
 		return gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
 	}
 	rc = gnutls_hash(hash_hnd, nt_pass, 16);
 	if (rc < 0) {
 		gnutls_hash_deinit(hash_hnd, NULL);
+		centry_free(centry);
 		return gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
 	}
 	gnutls_hash_deinit(hash_hnd, salted_hash);
-- 
2.23.0