s3-rpc_server: Free the children of p->mem_ctx.
authorAndreas Schneider <asn@samba.org>
Tue, 26 Jul 2011 10:07:20 +0000 (12:07 +0200)
committerAndreas Schneider <asn@samba.org>
Tue, 9 Aug 2011 08:41:47 +0000 (10:41 +0200)
Free the children of p->mem_ctx after processing a complete incoming and
outgoing request.

Signed-off-by: Simo Sorce <idra@samba.org>
source3/rpc_server/rpc_server.c

index b03715c024ca7bf9cae399b81de24c925c3b3fdb..c66d74771a77db0df509ed33b6dcd025e869c9cf 100644 (file)
@@ -320,7 +320,7 @@ static void named_pipe_accept_function(struct tevent_context *ev_ctx,
        struct tevent_req *subreq;
        int ret;
 
-       npc = talloc_zero(NULL, struct named_pipe_client);
+       npc = talloc_zero(ev_ctx, struct named_pipe_client);
        if (!npc) {
                DEBUG(0, ("Out of memory!\n"));
                close(fd);
@@ -589,6 +589,8 @@ static void named_pipe_packet_done(struct tevent_req *subreq)
        data_blob_free(&npc->p->out_data.frag);
        data_blob_free(&npc->p->out_data.rdata);
 
+       talloc_free_children(npc->p->mem_ctx);
+
        /* Wait for the next packet */
        subreq = dcerpc_read_ncacn_packet_send(npc, npc->ev, npc->tstream);
        if (!subreq) {
@@ -1287,6 +1289,8 @@ static void dcerpc_ncacn_packet_done(struct tevent_req *subreq)
        data_blob_free(&ncacn_conn->p->out_data.frag);
        data_blob_free(&ncacn_conn->p->out_data.rdata);
 
+       talloc_free_children(ncacn_conn->p->mem_ctx);
+
        /* Wait for the next packet */
        subreq = dcerpc_read_ncacn_packet_send(ncacn_conn,
                                               ncacn_conn->ev_ctx,