summaryrefslogtreecommitdiff
path: root/source4/ntvfs
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2005-08-16 10:57:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:33:24 -0500
commitad9022e304ec07e56d2af1aaeb99a6f1faea62aa (patch)
treecc255a8ce671eddde4d8e6d8b7ba17f50ce5f8dd /source4/ntvfs
parent2f195406b6f1ff943eb000741e09cafbdbdaf58e (diff)
downloadsamba-ad9022e304ec07e56d2af1aaeb99a6f1faea62aa.tar.gz
samba-ad9022e304ec07e56d2af1aaeb99a6f1faea62aa.tar.bz2
samba-ad9022e304ec07e56d2af1aaeb99a6f1faea62aa.zip
r9320: Fix premature dereference bug found by Coverty and also get rid of non-used memory context
(This used to be commit 127e06492a545940443c93e9aec66eebefa26dc2)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r--source4/ntvfs/unixuid/vfs_unixuid.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/source4/ntvfs/unixuid/vfs_unixuid.c b/source4/ntvfs/unixuid/vfs_unixuid.c
index 41b1d7965d..928ff8241b 100644
--- a/source4/ntvfs/unixuid/vfs_unixuid.c
+++ b/source4/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;
}