]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
auth4: Fix CID 1034877 Resource leak
authorVolker Lendecke <vl@samba.org>
Mon, 30 Sep 2024 09:05:20 +0000 (11:05 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 2 Oct 2024 14:19:08 +0000 (14:19 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Oct  2 14:19:08 UTC 2024 on atb-devel-224

source4/auth/session.c

index 9c9d8c4aaffdb3339f52836227ea3de36d203662..8f5d58b343720c2024f93b14212eab0ee65b86a2 100644 (file)
@@ -365,6 +365,7 @@ struct auth_session_info *auth_session_info_from_transport(TALLOC_CTX *mem_ctx,
 
                creds = cli_credentials_init(session_info);
                if (!creds) {
+                       gss_release_cred(&minor_status, &cred_handle);
                        *reason = "Out of memory in cli_credentials_init()";
                        return NULL;
                }
@@ -372,6 +373,7 @@ struct auth_session_info *auth_session_info_from_transport(TALLOC_CTX *mem_ctx,
 
                ok = cli_credentials_set_conf(creds, lp_ctx);
                if (!ok) {
+                       gss_release_cred(&minor_status, &cred_handle);
                        *reason = "Failed to load smb.conf";
                        return NULL;
                }
@@ -385,6 +387,7 @@ struct auth_session_info *auth_session_info_from_transport(TALLOC_CTX *mem_ctx,
                                                           CRED_SPECIFIED,
                                                           &error_string);
                if (ret) {
+                       gss_release_cred(&minor_status, &cred_handle);
                        *reason = talloc_asprintf(mem_ctx,
                                                  "Failed to set pipe forwarded "
                                                  "creds: %s\n", error_string);