diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-09-28 05:44:59 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:25 -0500 |
commit | b2f1a29e4348a5bc34a87d72d526e23e421ed9d5 (patch) | |
tree | c69987090647da615193f1361e03986588ac164d /source4/ntvfs | |
parent | a675b09e8d45b9298df8f8c82bbaa7b91a793eb5 (diff) | |
download | samba-b2f1a29e4348a5bc34a87d72d526e23e421ed9d5.tar.gz samba-b2f1a29e4348a5bc34a87d72d526e23e421ed9d5.tar.bz2 samba-b2f1a29e4348a5bc34a87d72d526e23e421ed9d5.zip |
r2710: continue with the new style of providing a parent context whenever
possible to a structure creation routine. This makes for much easier
global cleanup.
(This used to be commit e14ee428ec357fab76a960387a9820a673786e27)
Diffstat (limited to 'source4/ntvfs')
-rw-r--r-- | source4/ntvfs/cifs/vfs_cifs.c | 15 | ||||
-rw-r--r-- | source4/ntvfs/ipc/vfs_ipc.c | 26 |
2 files changed, 16 insertions, 25 deletions
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index 3931792ee8..c0160e6852 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -122,13 +122,14 @@ static NTSTATUS cvfs_connect(struct smbsrv_request *req, const char *sharename, ntvfs_set_private(req->tcon, depth, private); - status = smbcli_tree_full_connection(&private->tree, - "vfs_cifs", - host, - 0, - remote_share, "?????", - user, domain, - pass); + status = smbcli_tree_full_connection(private, + &private->tree, + "vfs_cifs", + host, + 0, + remote_share, "?????", + user, domain, + pass); if (!NT_STATUS_IS_OK(status)) { return status; } diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c index 33e1287d21..59da6faea5 100644 --- a/source4/ntvfs/ipc/vfs_ipc.c +++ b/source4/ntvfs/ipc/vfs_ipc.c @@ -38,7 +38,6 @@ struct ipc_private { /* a list of open pipes */ struct pipe_state { struct pipe_state *next, *prev; - TALLOC_CTX *mem_ctx; const char *pipe_name; uint16_t fnum; struct dcesrv_connection *dce_conn; @@ -85,10 +84,9 @@ again: */ static void pipe_shutdown(struct ipc_private *private, struct pipe_state *p) { - TALLOC_CTX *mem_ctx = private->pipe_list->mem_ctx; - dcesrv_endpoint_disconnect(private->pipe_list->dce_conn); - DLIST_REMOVE(private->pipe_list, private->pipe_list); - talloc_destroy(mem_ctx); + talloc_free(p->dce_conn); + DLIST_REMOVE(private->pipe_list, p); + talloc_destroy(p); } @@ -199,33 +197,25 @@ static NTSTATUS ipc_open_generic(struct smbsrv_request *req, const char *fname, struct pipe_state **ps) { struct pipe_state *p; - TALLOC_CTX *mem_ctx; NTSTATUS status; struct dcesrv_ep_description ep_description; struct auth_session_info *session_info = NULL; NTVFS_GET_PRIVATE(ipc_private, private, req); - mem_ctx = talloc_init("ipc_open '%s'", fname); - if (!mem_ctx) { - return NT_STATUS_NO_MEMORY; - } - - p = talloc(mem_ctx, sizeof(struct pipe_state)); + p = talloc_p(private, struct pipe_state); if (!p) { - talloc_destroy(mem_ctx); return NT_STATUS_NO_MEMORY; } - p->mem_ctx = mem_ctx; - p->pipe_name = talloc_strdup(mem_ctx, fname); + p->pipe_name = talloc_strdup(p, fname); if (!p->pipe_name) { - talloc_destroy(mem_ctx); + talloc_free(p); return NT_STATUS_NO_MEMORY; } p->fnum = find_next_fnum(private); if (p->fnum == 0) { - talloc_destroy(mem_ctx); + talloc_free(p); return NT_STATUS_TOO_MANY_OPENED_FILES; } @@ -261,7 +251,7 @@ static NTSTATUS ipc_open_generic(struct smbsrv_request *req, const char *fname, session_info, &p->dce_conn); if (!NT_STATUS_IS_OK(status)) { - talloc_destroy(mem_ctx); + talloc_free(p); return status; } |