s4:winbind: don't leak libnet_context into the main event context
[obnox/samba/samba-obnox.git] / source4 / winbind / wb_init_domain.c
index 5e2aa4700546c1d5121f239b78aa7d9ebea9b9ce..70dbaa9ce8101548f2f2fc9479d13ab96437f281 100644 (file)
@@ -144,6 +144,8 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx,
 
        state->domain->libnet_ctx = libnet_context_init(service->task->event_ctx, 
                                                        service->task->lp_ctx);
+       if (state->domain->libnet_ctx == NULL) goto failed;
+       talloc_steal(state->domain, state->domain->libnet_ctx);
 
        /* Create a credentials structure */
        state->domain->libnet_ctx->cred = cli_credentials_init(state->domain);