s3: Fix a valgrind error
authorVolker Lendecke <vl@samba.org>
Sun, 5 Jun 2011 11:56:39 +0000 (13:56 +0200)
committerVolker Lendecke <vlendec@samba.org>
Sun, 5 Jun 2011 11:19:39 +0000 (13:19 +0200)
For me this fixes

==1950== Invalid read of size 4
==1950==    at 0x81EBED5: GUID_equal (uuid.c:239)
==1950==    by 0x81E51AB: ndr_syntax_id_equal (ndr_misc.c:35)
==1950==    by 0x82EB0D1: get_iface_from_syntax (rpc_common.c:160)
==1950==    by 0x82EB25E: get_pipe_name_from_syntax (rpc_common.c:179)
==1950==    by 0x8509E4F: close_policy_by_pipe (rpc_handles.c:322)
==1950==    by 0x8507941: close_internal_rpc_pipe_hnd (rpc_ncacn_np.c:109)
==1950==    by 0x468270: _talloc_free_internal (talloc.c:826)
==1950==    by 0x467EE0: _talloc_free_internal (talloc.c:1268)
==1950==    by 0x467EE0: _talloc_free_internal (talloc.c:1268)
==1950==    by 0x467EE0: _talloc_free_internal (talloc.c:1268)
==1950==    by 0x467EE0: _talloc_free_internal (talloc.c:1268)
==1950==    by 0x80E6487: sam_trusted_domains (winbindd_samr.c:406)
==1950==  Address 0x687ea4 is 20 bytes inside a block of size 40 free'd
==1950==    at 0x58CDC: free (in /usr/local/lib/valgrind/vgpreload_memcheck-x86-freebsd.so)
==1950==    by 0x8507812: free_pipe_rpc_context_internal (rpc_ncacn_np.c:74)
==1950==    by 0x8507936: close_internal_rpc_pipe_hnd (rpc_ncacn_np.c:106)
==1950==    by 0x468270: _talloc_free_internal (talloc.c:826)
==1950==    by 0x467EE0: _talloc_free_internal (talloc.c:1268)
==1950==    by 0x467EE0: _talloc_free_internal (talloc.c:1268)
==1950==    by 0x467EE0: _talloc_free_internal (talloc.c:1268)
==1950==    by 0x467EE0: _talloc_free_internal (talloc.c:1268)
==1950==    by 0x80E6487: sam_trusted_domains (winbindd_samr.c:406)
==1950==    by 0x80C2F85: trusted_domains (winbindd_cache.c:2820)
==1950==    by 0x80D5188: winbindd_dual_list_trusted_domains (winbindd_misc.c:162)
==1950==    by 0x80E987F: wb_child_request_trigger (winbindd_dual.c:437)
==1950==

Andreas, Guenther, please check!

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Jun  5 13:19:39 CEST 2011 on sn-devel-104

source3/rpc_server/rpc_ncacn_np.c

index 4446578e3f99f945442179a060f371439a7f99c3..e578c77ddab5a1b801f5607a124fa2457fa5e2a1 100644 (file)
@@ -103,11 +103,11 @@ int close_internal_rpc_pipe_hnd(struct pipes_struct *p)
 
        TALLOC_FREE(p->auth.auth_ctx);
 
-       free_pipe_rpc_context_internal( p->contexts );
-
        /* Free the handles database. */
        close_policy_by_pipe(p);
 
+       free_pipe_rpc_context_internal( p->contexts );
+
        DLIST_REMOVE(InternalPipes, p);
 
        ZERO_STRUCTP(p);