Author: ab
Date: 2005-08-16 10:57:21 +0000 (Tue, 16 Aug 2005)
New Revision: 9320

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9320

Log:
Fix premature dereference bug found by Coverty and also get rid of non-used 
memory context
Modified:
   branches/SAMBA_4_0/source/ntvfs/unixuid/vfs_unixuid.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/unixuid/vfs_unixuid.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/unixuid/vfs_unixuid.c       2005-08-16 
10:52:02 UTC (rev 9319)
+++ branches/SAMBA_4_0/source/ntvfs/unixuid/vfs_unixuid.c       2005-08-16 
10:57:21 UTC (rev 9320)
@@ -146,8 +146,7 @@
                                       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 @@
                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 @@
        } 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 @@
 
        status = set_unix_security(newsec);
        if (!NT_STATUS_IS_OK(status)) {
-               talloc_free(ctx);
                return status;
        }
 
-       talloc_free(ctx);
-
        return NT_STATUS_OK;
 }
 

Reply via email to