r9320: Fix premature dereference bug found by Coverty and also get rid of non-used...
authorAlexander Bokovoy <ab@samba.org>
Tue, 16 Aug 2005 10:57:21 +0000 (10:57 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:33:24 +0000 (13:33 -0500)
(This used to be commit 127e06492a545940443c93e9aec66eebefa26dc2)

source4/ntvfs/unixuid/vfs_unixuid.c

index 41b1d7965df2eb0a7cdb1f4ad8b6cb8e2b8fa277..928ff8241b27eba7006d37a8b45159f7af76ba04 100644 (file)
@@ -146,8 +146,7 @@ static NTSTATUS unixuid_setup_security(struct ntvfs_module_context *ntvfs,
                                       struct smbsrv_request *req, struct unix_sec_ctx **sec)
 {
        struct unixuid_private *private = ntvfs->private_data;
-       struct security_token *token = req->session->session_info->security_token;
-       void *ctx = talloc_new(req);
+       struct security_token *token;
        struct unix_sec_ctx *newsec;
        NTSTATUS status;
 
@@ -155,6 +154,8 @@ static NTSTATUS unixuid_setup_security(struct ntvfs_module_context *ntvfs,
                return NT_STATUS_ACCESS_DENIED;
        }
 
+       token = req->session->session_info->security_token;
+
        *sec = save_unix_security(req);
        if (*sec == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -165,7 +166,6 @@ static NTSTATUS unixuid_setup_security(struct ntvfs_module_context *ntvfs,
        } else {
                status = nt_token_to_unix_security(ntvfs, req, token, &newsec);
                if (!NT_STATUS_IS_OK(status)) {
-                       talloc_free(ctx);
                        return status;
                }
                if (private->last_sec_ctx) {
@@ -178,12 +178,9 @@ static NTSTATUS unixuid_setup_security(struct ntvfs_module_context *ntvfs,
 
        status = set_unix_security(newsec);
        if (!NT_STATUS_IS_OK(status)) {
-               talloc_free(ctx);
                return status;
        }
 
-       talloc_free(ctx);
-
        return NT_STATUS_OK;
 }