From: Alexander Bokovoy Date: Tue, 16 Aug 2005 10:57:21 +0000 (+0000) Subject: r9320: Fix premature dereference bug found by Coverty and also get rid of non-used... X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=127e06492a545940443c93e9aec66eebefa26dc2;p=jelmer%2Fsamba4-debian.git r9320: Fix premature dereference bug found by Coverty and also get rid of non-used memory context --- diff --git a/source/ntvfs/unixuid/vfs_unixuid.c b/source/ntvfs/unixuid/vfs_unixuid.c index 41b1d7965..928ff8241 100644 --- a/source/ntvfs/unixuid/vfs_unixuid.c +++ b/source/ntvfs/unixuid/vfs_unixuid.c @@ -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; }