summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-04-24 14:23:11 +0200
committerVolker Lendecke <vl@samba.org>2012-04-24 18:18:05 +0200
commit2d01099acc77d433f06f36f854f27fd9f1e43f05 (patch)
tree004313472045a1465d878c5653066c1ffe3b4833 /source3
parentd1d0f1d11d07ee2ae64e7a83493e5dddde8611c0 (diff)
downloadsamba-2d01099acc77d433f06f36f854f27fd9f1e43f05.tar.gz
samba-2d01099acc77d433f06f36f854f27fd9f1e43f05.tar.bz2
samba-2d01099acc77d433f06f36f854f27fd9f1e43f05.zip
s3: Simplify check_reduced_name a bit
It's pointless to do a talloc_asprintf with a SMB_STRDUP on the result. Use asprintf directly. Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Tue Apr 24 18:18:05 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/vfs.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index b330c03bfc..6c9692a65b 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1089,6 +1089,7 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
char *dir_name = NULL;
const char *last_component = NULL;
char *new_name = NULL;
+ int ret;
/* Last component didn't exist.
Remove it and try and canonicalise
@@ -1114,18 +1115,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
nt_errstr(status)));
return status;
}
- new_name = talloc_asprintf(ctx,
- "%s/%s",
- resolved_name,
- last_component);
- if (!new_name) {
- return NT_STATUS_NO_MEMORY;
- }
+ ret = asprintf(&new_name, "%s/%s",
+ resolved_name, last_component);
SAFE_FREE(resolved_name);
- resolved_name = SMB_STRDUP(new_name);
- if (!resolved_name) {
+ if (ret == -1) {
return NT_STATUS_NO_MEMORY;
}
+ resolved_name = new_name;
break;
}
default: