]> git.samba.org - samba.git/commitdiff
winbindd: Free memory before we exit the connect child
authorAndreas Schneider <asn@samba.org>
Fri, 9 Feb 2018 14:27:42 +0000 (15:27 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Mon, 12 Feb 2018 18:52:48 +0000 (19:52 +0100)
This will make valgrind happy.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/winbindd/winbindd_cm.c

index 54416e02dcdae4155f0183acc8974daaf4b58bee..4229647dc4d135c9edf3146cce8fd0899ccea2b1 100644 (file)
@@ -199,6 +199,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
        pid_t parent_pid = getpid();
        char *lfile = NULL;
        NTSTATUS status;
+       bool ok;
 
        if (domain->dc_probe_pid != (pid_t)-1) {
                /*
@@ -269,7 +270,9 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
                _exit(1);
        }
 
-       if ((!get_dcs(mem_ctx, domain, &dcs, &num_dcs, 0)) || (num_dcs == 0)) {
+       ok = get_dcs(mem_ctx, domain, &dcs, &num_dcs, 0);
+       TALLOC_FREE(mem_ctx);
+       if (!ok || (num_dcs == 0)) {
                /* Still offline ? Can't find DC's. */
                messaging_send_buf(server_messaging_context(),
                                   pid_to_procid(parent_pid),