diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-08-21 07:43:29 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:14 -0500 |
commit | b7e1ea20dc873a753ff64653987130f03897a4e9 (patch) | |
tree | 67f37a1a19113c622dedf942f39b27ca994c1b05 /source4/libcli/raw/clitree.c | |
parent | b45f4ebbb880e41abf86abb54264123f3edbde05 (diff) | |
download | samba-b7e1ea20dc873a753ff64653987130f03897a4e9.tar.gz samba-b7e1ea20dc873a753ff64653987130f03897a4e9.tar.bz2 samba-b7e1ea20dc873a753ff64653987130f03897a4e9.zip |
r1985: take advantage of the new talloc in a few more places
(This used to be commit 6ffdfd779936ce8c5ca49c5f444e8da2bbeee0a8)
Diffstat (limited to 'source4/libcli/raw/clitree.c')
-rw-r--r-- | source4/libcli/raw/clitree.c | 15 |
1 files changed, 5 insertions, 10 deletions
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); |