s3-rpc_server: Use talloc for pipe_rpc_fns
authorSimo Sorce <idra@samba.org>
Wed, 27 Jul 2011 20:40:21 +0000 (16:40 -0400)
committerSimo Sorce <idra@samba.org>
Thu, 28 Jul 2011 15:41:08 +0000 (17:41 +0200)
Everything uses talloc in the rpc server nowadays, remove this ancient use of
malloc. This also allows us to remove the free fucntion and let talloc handle
it properly.

Autobuild-User: Simo Sorce <idra@samba.org>
Autobuild-Date: Thu Jul 28 17:41:08 CEST 2011 on sn-devel-104

source3/rpc_server/rpc_handles.c
source3/rpc_server/rpc_ncacn_np.c
source3/rpc_server/srv_pipe.c

index 19e7655221bf18f8eab8a2a50808f6a83e69be55..87145ca848f5f84a9413f38af7babfdc564acc26 100644 (file)
@@ -107,20 +107,6 @@ bool check_open_pipes(void)
  Close an rpc pipe.
 ****************************************************************************/
 
-static void free_pipe_rpc_context_internal(struct pipe_rpc_fns *list)
-{
-       struct pipe_rpc_fns *tmp = list;
-       struct pipe_rpc_fns *tmp2;
-
-       while (tmp) {
-               tmp2 = tmp->next;
-               SAFE_FREE(tmp);
-               tmp = tmp2;
-       }
-
-       return;
-}
-
 int close_internal_rpc_pipe_hnd(struct pipes_struct *p)
 {
        if (!p) {
@@ -131,8 +117,6 @@ int close_internal_rpc_pipe_hnd(struct pipes_struct *p)
        /* Free the handles database. */
        close_policy_by_pipe(p);
 
-       free_pipe_rpc_context_internal(p->contexts);
-
        DLIST_REMOVE(InternalPipes, p);
 
        return 0;
index 2ed4a017043bae31da93f78d9c30d6fb82e0e8c7..1080a98eb44a96750ae9b941ee2e13f5e0942cbc 100644 (file)
@@ -80,10 +80,11 @@ struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       context_fns = SMB_MALLOC_P(struct pipe_rpc_fns);
+       context_fns = talloc(p, struct pipe_rpc_fns);
        if (context_fns == NULL) {
-               DEBUG(0,("malloc() failed!\n"));
-               return False;
+               DEBUG(0,("talloc() failed!\n"));
+               TALLOC_FREE(p);
+               return NULL;
        }
 
        context_fns->next = context_fns->prev = NULL;
index 233dfdf5b2e9f99e99e358a41cd2d2c100855593..058f1b8b14fd6dc07d14a110c4b4ec193f7d8f00 100644 (file)
@@ -356,10 +356,10 @@ static bool check_bind_req(struct pipes_struct *p,
                return false;
        }
 
-       context_fns = SMB_MALLOC_P(struct pipe_rpc_fns);
+       context_fns = talloc(p, struct pipe_rpc_fns);
        if (context_fns == NULL) {
-               DEBUG(0,("check_bind_req: malloc() failed!\n"));
-               return False;
+               DEBUG(0,("check_bind_req: talloc() failed!\n"));
+               return false;
        }
 
        context_fns->next = context_fns->prev = NULL;