From e7c76df8c0fa4a361c433684553ba1384166a564 Mon Sep 17 00:00:00 2001 From: Alexey Tikhonov Date: Wed, 12 Feb 2025 11:30:22 +0100 Subject: [PATCH] KCM: another memory leak fixed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` ... talloc_new: src/responder/kcm/kcmsrv_ccache.c:405 contains 0 bytes in 1 blocks (ref 0) 0x563feaabc0a0 talloc_new: src/responder/kcm/kcmsrv_ccache.c:405 contains 0 bytes in 1 blocks (ref 0) 0x563feaa84f90 talloc_new: src/responder/kcm/kcmsrv_ccache.c:405 contains 0 bytes in 1 blocks (ref 0) 0x563feaabf520 ... ``` Reviewed-by: Alejandro López (cherry picked from commit 9e72bc242b600158d7920b2b98644efa42fd1ffa) --- src/responder/kcm/kcmsrv_ccache.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/responder/kcm/kcmsrv_ccache.c b/src/responder/kcm/kcmsrv_ccache.c index 6e4ea64e0..4f4f8b46a 100644 --- a/src/responder/kcm/kcmsrv_ccache.c +++ b/src/responder/kcm/kcmsrv_ccache.c @@ -404,7 +404,7 @@ krb5_creds **kcm_cc_unmarshal(TALLOC_CTX *mem_ctx, tmp_ctx = talloc_new(NULL); if (tmp_ctx == NULL) { - goto done; + goto fail; } for (cred = kcm_cc_get_cred(cc); cred != NULL; cred = kcm_cc_next_cred(cred)) { @@ -417,7 +417,7 @@ krb5_creds **kcm_cc_unmarshal(TALLOC_CTX *mem_ctx, cred_list[i] = kcm_cred_to_krb5(krb_context, cred); if (cred_list[i] == NULL) { DEBUG(SSSDBG_CRIT_FAILURE, "Failed to convert kcm cred to krb5\n"); - goto done; + goto fail; } } @@ -426,8 +426,10 @@ krb5_creds **kcm_cc_unmarshal(TALLOC_CTX *mem_ctx, talloc_steal(mem_ctx, cred_list); + talloc_free(tmp_ctx); return cred_list; -done: + +fail: talloc_free(tmp_ctx); return NULL; #endif -- 2.47.0