summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-02-27 19:22:02 +0000
committerJeremy Allison <jra@samba.org>2001-02-27 19:22:02 +0000
commit5265ce7837a185977f71bcb39a41b57492e24964 (patch)
treebc5f6b359d30f74f156af64de8253c2e8d311343 /source3/rpc_server
parentdbc5cace14de14556da7a32cd9f4a82ef522e401 (diff)
downloadsamba-5265ce7837a185977f71bcb39a41b57492e24964.tar.gz
samba-5265ce7837a185977f71bcb39a41b57492e24964.tar.bz2
samba-5265ce7837a185977f71bcb39a41b57492e24964.zip
Added total memory allocated counter to talloc, so we can tell if a talloc
pool is getting bloated. Also added a talloc_zero function to return zeroed memory. Added debug in rpc_server/srv_pipe_hnd.c so we know when a talloc pool is being freed. Syncup with srv_pipe_hnd.c from 2.2 so we are freeing memory at the same time. Jeremy. (This used to be commit d3a56c6042acf037bbd53de88d7636a5803ead20)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index b8ee235185..3b60c78ade 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -485,14 +485,6 @@ static ssize_t process_complete_pdu(pipes_struct *p)
char *data_p = (char *)&p->in_data.current_in_pdu[0];
BOOL reply = False;
- if (p->mem_ctx) {
- talloc_destroy_pool(p->mem_ctx);
- } else {
- p->mem_ctx = talloc_init();
- if (p->mem_ctx == NULL)
- p->fault_state = True;
- }
-
if(p->fault_state) {
DEBUG(10,("process_complete_pdu: pipe %s in fault state.\n",
p->name ));
@@ -713,7 +705,7 @@ returning %d bytes.\n", p->name, (unsigned int)p->out_data.current_pdu_len,
memcpy( data, &p->out_data.current_pdu[p->out_data.current_pdu_sent], (size_t)data_returned);
p->out_data.current_pdu_sent += (uint32)data_returned;
- return data_returned;
+ goto out;
}
/*
@@ -727,9 +719,10 @@ returning %d bytes.\n", p->name, (unsigned int)p->out_data.current_pdu_len,
if(p->out_data.data_sent_length >= prs_offset(&p->out_data.rdata)) {
/*
- * We have sent all possible data. Return 0.
+ * We have sent all possible data, return 0.
*/
- return 0;
+ data_returned = 0;
+ goto out;
}
/*
@@ -748,6 +741,26 @@ returning %d bytes.\n", p->name, (unsigned int)p->out_data.current_pdu_len,
memcpy( data, p->out_data.current_pdu, (size_t)data_returned);
p->out_data.current_pdu_sent += (uint32)data_returned;
+
+ out:
+
+ if(p->out_data.data_sent_length >= prs_offset(&p->out_data.rdata)) {
+ /*
+ * We have copied all possible data into the current_pdu. This RPC is finished.
+ * Reset the talloc context to free any allocated data from this RPC.
+ */
+
+ if (p->mem_ctx) {
+ DEBUG(3,("read_from_pipe: destroying talloc pool of size %u\n", talloc_pool_size(p->mem_ctx) ));
+ talloc_destroy_pool(p->mem_ctx);
+ } else {
+ p->mem_ctx = talloc_init();
+ if (p->mem_ctx == NULL)
+ p->fault_state = True;
+ }
+
+ }
+
return data_returned;
}
@@ -872,5 +885,4 @@ pipes_struct *get_rpc_pipe(int pnum)
return NULL;
}
-
#undef OLD_NTDOMAIN