summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-03-14 18:35:36 +0100
committerVolker Lendecke <vlendec@samba.org>2011-03-14 19:21:11 +0100
commit746b299ec1b11ea1e70c130b69a9a379ec478750 (patch)
treefd334151498af784cca3b5d18f1c0eca99c32c2e
parent43e343be8142b26b690c30faabf259205098a008 (diff)
downloadsamba-746b299ec1b11ea1e70c130b69a9a379ec478750.tar.gz
samba-746b299ec1b11ea1e70c130b69a9a379ec478750.tar.bz2
samba-746b299ec1b11ea1e70c130b69a9a379ec478750.zip
s3: Fix the talloc hierarchy in shadow_copy2_connectpath
We have to return on talloc_tos() because we don't have a mem_ctx given to us. So we have to create a separate temporary talloc context. Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Mon Mar 14 19:21:11 CET 2011 on sn-devel-104
-rw-r--r--source3/modules/vfs_shadow_copy2.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 93330f4b50..e3c3f9f3a0 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -684,7 +684,7 @@ static char *shadow_copy2_realpath(vfs_handle_struct *handle,
static const char *shadow_copy2_connectpath(struct vfs_handle_struct *handle,
const char *fname)
{
- TALLOC_CTX *tmp_ctx = talloc_stackframe();
+ TALLOC_CTX *tmp_ctx;
const char *snapdir, *baseoffset, *basedir, *gmt_start;
size_t baselen;
char *ret;
@@ -695,7 +695,14 @@ static const char *shadow_copy2_connectpath(struct vfs_handle_struct *handle,
return handle->conn->connectpath;
}
- fname = shadow_copy2_normalise_path(talloc_tos(), fname, gmt_start);
+ /*
+ * We have to create a real temporary context because we have
+ * to put our result on talloc_tos(). Thus we can't use a
+ * talloc_stackframe() here.
+ */
+ tmp_ctx = talloc_new(talloc_tos());
+
+ fname = shadow_copy2_normalise_path(tmp_ctx, fname, gmt_start);
if (fname == NULL) {
TALLOC_FREE(tmp_ctx);
return NULL;