From b7e1ea20dc873a753ff64653987130f03897a4e9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 21 Aug 2004 07:43:29 +0000 Subject: r1985: take advantage of the new talloc in a few more places (This used to be commit 6ffdfd779936ce8c5ca49c5f444e8da2bbeee0a8) --- source4/libcli/raw/clitree.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'source4/libcli/raw/clitree.c') diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c index 57e322da32..2d642a9a8c 100644 --- a/source4/libcli/raw/clitree.c +++ b/source4/libcli/raw/clitree.c @@ -33,18 +33,13 @@ struct smbcli_tree *smbcli_tree_init(struct smbcli_session *session) { struct smbcli_tree *tree; - TALLOC_CTX *mem_ctx = talloc_init("smbcli_tree"); - if (mem_ctx == NULL) { - return NULL; - } - tree = talloc_zero(mem_ctx, sizeof(*tree)); + tree = talloc_named(NULL, sizeof(*tree), "smbcli_tree"); if (!tree) { - talloc_destroy(mem_ctx); return NULL; } - tree->mem_ctx = mem_ctx; + ZERO_STRUCTP(tree); tree->session = session; tree->session->reference_count++; @@ -60,7 +55,7 @@ void smbcli_tree_close(struct smbcli_tree *tree) tree->reference_count--; if (tree->reference_count <= 0) { smbcli_session_close(tree->session); - talloc_destroy(tree->mem_ctx); + talloc_free(tree); } } @@ -295,10 +290,10 @@ NTSTATUS smbcli_tree_full_connection(struct smbcli_tree **ret_tree, tree->tid = tcon.tconx.out.cnum; if (tcon.tconx.out.dev_type) { - tree->device = talloc_strdup(tree->mem_ctx, tcon.tconx.out.dev_type); + tree->device = talloc_strdup(tree, tcon.tconx.out.dev_type); } if (tcon.tconx.out.fs_type) { - tree->fs_type = talloc_strdup(tree->mem_ctx, tcon.tconx.out.fs_type); + tree->fs_type = talloc_strdup(tree, tcon.tconx.out.fs_type); } talloc_destroy(mem_ctx); -- cgit