summaryrefslogtreecommitdiff
path: root/source3/smbd/vfs.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-01-09 17:11:04 -0800
committerJeremy Allison <jra@samba.org>2008-01-09 17:11:04 -0800
commit253fbf1a6ece5c8dc9759e3535b7f9fa46883c1b (patch)
tree3e4abe3bc537565b45699fbffaf1a8c0fcbc7f99 /source3/smbd/vfs.c
parent9003e8e50fd308bb66bfbd635193e725b2442cbb (diff)
downloadsamba-253fbf1a6ece5c8dc9759e3535b7f9fa46883c1b.tar.gz
samba-253fbf1a6ece5c8dc9759e3535b7f9fa46883c1b.tar.bz2
samba-253fbf1a6ece5c8dc9759e3535b7f9fa46883c1b.zip
Make use of talloc_pool in the main codepaths. Remove the sub-contexts.
Jeremy. (This used to be commit bc932b8ad4396f76b71c43efe9a6346f89c3632c)
Diffstat (limited to 'source3/smbd/vfs.c')
-rw-r--r--source3/smbd/vfs.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 9a5e0aff60..bb4e77ed31 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -869,14 +869,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
return map_nt_error_from_unix(errno);
case ENOENT:
{
- TALLOC_CTX *tmp_ctx = talloc_stackframe();
+ TALLOC_CTX *ctx = talloc_tos();
char *tmp_fname = NULL;
char *last_component = NULL;
/* Last component didn't exist. Remove it and try and canonicalise the directory. */
- tmp_fname = talloc_strdup(tmp_ctx, fname);
+ tmp_fname = talloc_strdup(ctx, fname);
if (!tmp_fname) {
- TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
p = strrchr_m(tmp_fname, '/');
@@ -885,10 +884,9 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
last_component = p;
} else {
last_component = tmp_fname;
- tmp_fname = talloc_strdup(tmp_ctx,
+ tmp_fname = talloc_strdup(ctx,
".");
if (!tmp_fname) {
- TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
}
@@ -900,15 +898,13 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
#endif
if (!resolved_name) {
DEBUG(3,("reduce_name: couldn't get realpath for %s\n", fname));
- TALLOC_FREE(tmp_ctx);
return map_nt_error_from_unix(errno);
}
- tmp_fname = talloc_asprintf(tmp_ctx,
+ tmp_fname = talloc_asprintf(ctx,
"%s/%s",
resolved_name,
last_component);
if (!tmp_fname) {
- TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
#ifdef REALPATH_TAKES_NULL
@@ -922,7 +918,6 @@ NTSTATUS check_reduced_name(connection_struct *conn, const char *fname)
safe_strcpy(resolved_name_buf, tmp_fname, PATH_MAX);
resolved_name = resolved_name_buf;
#endif
- TALLOC_FREE(tmp_ctx);
break;
}
default: