]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
auth:credentials: Fix resource leak in cli_credentials_set_from_ccache()
authorPavel Filipenský <pfilipensky@samba.org>
Wed, 26 Jul 2023 14:28:36 +0000 (16:28 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 31 Jul 2023 10:56:54 +0000 (10:56 +0000)
Reported by Red Hat internal covscan
leaked_storage: Variable "princ" going out of scope leaks the storage it points to.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
auth/credentials/credentials_krb5.c

index 796b52ea905a8555576178c25159c984bef6f294..71863367aa5504aeba29073b88c0beace5059cc8 100644 (file)
@@ -261,6 +261,7 @@ static int cli_credentials_set_from_ccache(struct cli_credentials *cred,
                (*error_string) = talloc_asprintf(cred, "failed to unparse principal from ccache: %s\n",
                                                  smb_get_krb5_error_message(ccache->smb_krb5_context->krb5_context,
                                                                             ret, cred));
+               krb5_free_principal(ccache->smb_krb5_context->krb5_context, princ);
                return ret;
        }