From b5e0e831500469fbf53f70494c3d02ddd494dae1 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 31 Jul 2024 13:39:46 +1200 Subject: [PATCH] dsdb:cracknames: free more on error (CID 240724) Signed-off-by: Douglas Bagnall Reviewed-by: Jennifer Sutton Autobuild-User(master): Douglas Bagnall Autobuild-Date(master): Wed Aug 28 05:39:36 UTC 2024 on atb-devel-224 --- source4/dsdb/samdb/cracknames.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c index 46b41fd2cee..91e02f9d94d 100644 --- a/source4/dsdb/samdb/cracknames.c +++ b/source4/dsdb/samdb/cracknames.c @@ -307,11 +307,14 @@ static WERROR DsCrackNameUPN(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, realm = smb_krb5_principal_get_realm( mem_ctx, smb_krb5_context->krb5_context, principal); if (realm == NULL) { + krb5_free_principal(smb_krb5_context->krb5_context, principal); return WERR_NOT_ENOUGH_MEMORY; } realm_encoded = ldb_binary_encode_string(mem_ctx, realm); if (realm_encoded == NULL) { + TALLOC_FREE(realm); + krb5_free_principal(smb_krb5_context->krb5_context, principal); return WERR_NOT_ENOUGH_MEMORY; }