diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-09-25 11:24:10 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:13 -0500 |
commit | d79c7d41da373dea7f95506c178b18f0dd896043 (patch) | |
tree | cc8063224f109163481973e5f076674c976d7b9f /source4/rpc_server/handles.c | |
parent | 998e8022b6d608840cf7c8058e24277b959da64d (diff) | |
download | samba-d79c7d41da373dea7f95506c178b18f0dd896043.tar.gz samba-d79c7d41da373dea7f95506c178b18f0dd896043.tar.bz2 samba-d79c7d41da373dea7f95506c178b18f0dd896043.zip |
r2627: use the new talloc capabilities in a bunch more places in the rpc
server code. This fixes a number of memory leaks I found when testing
with valgrind and smbtorture, as the cascading effect of a
talloc_free() ensures that anything derived from the top level object
is destroyed on disconnect.
(This used to be commit 76d0b8206ce64d6ff4a192979c43dddbec726d6e)
Diffstat (limited to 'source4/rpc_server/handles.c')
-rw-r--r-- | source4/rpc_server/handles.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/source4/rpc_server/handles.c b/source4/rpc_server/handles.c index 4cddfc896d..87749b27a1 100644 --- a/source4/rpc_server/handles.c +++ b/source4/rpc_server/handles.c @@ -28,19 +28,12 @@ struct dcesrv_handle *dcesrv_handle_new(struct dcesrv_connection *dce_conn, uint8_t handle_type) { - TALLOC_CTX *mem_ctx; struct dcesrv_handle *h; - mem_ctx = talloc_init("rpc handle type %d\n", handle_type); - if (!mem_ctx) { - return NULL; - } - h = talloc(mem_ctx, sizeof(*h)); + h = talloc_p(dce_conn, struct dcesrv_handle); if (!h) { - talloc_destroy(mem_ctx); return NULL; } - h->mem_ctx = mem_ctx; h->data = NULL; h->destroy = NULL; @@ -62,7 +55,7 @@ void dcesrv_handle_destroy(struct dcesrv_connection *dce_conn, h->destroy(dce_conn, h); } DLIST_REMOVE(dce_conn->handles, h); - talloc_destroy(h->mem_ctx); + talloc_free(h); } |