s4-torture: fixed a fd/mem leak in the RPC-LSA-SECRETS test
authorAndrew Tridgell <tridge@samba.org>
Tue, 20 Oct 2009 03:27:57 +0000 (14:27 +1100)
committerJeremy Allison <jra@samba.org>
Wed, 21 Oct 2009 23:52:23 +0000 (16:52 -0700)
This test left a large number of lsa pipes open, which could trigger
the server running out of fds

source4/torture/rpc/session_key.c

index 431897ac7776b2000ed2a31f1558c67aa3fef33e..1d3199944d97e98f8b3cede7d215f269021baef0 100644 (file)
@@ -148,6 +148,7 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
        struct dcerpc_binding *binding;
        const struct secret_settings *settings = 
                (const struct secret_settings *)_data;
+       NTSTATUS status;
 
        lp_set_cmdline(torture->lp_ctx, "ntlmssp client:keyexchange", settings->keyexchange?"True":"False");
        lp_set_cmdline(torture->lp_ctx, "ntlmssp_client:ntlm2", settings->ntlm2?"True":"False");
@@ -158,24 +159,28 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
 
        binding->flags |= settings->bindoptions;
 
-       torture_assert_ntstatus_ok(torture, 
-                                  dcerpc_pipe_connect_b(torture, &p, binding,
-                                                        &ndr_table_lsarpc,
-                                                        cmdline_credentials,
-                                                        torture->ev,
-                                                        torture->lp_ctx),
-                                  "connect");
+       status = dcerpc_pipe_connect_b(torture, &p, binding,
+                                      &ndr_table_lsarpc,
+                                      cmdline_credentials,
+                                      torture->ev,
+                                      torture->lp_ctx);
+
+       torture_assert_ntstatus_ok(torture, status, "connect");
 
        if (!test_lsa_OpenPolicy2(p, torture, &handle)) {
+               talloc_free(p);
                return false;
        }
 
        torture_assert(torture, handle, "OpenPolicy2 failed.  This test cannot run against this server");
        
        if (!test_CreateSecret_basic(p, torture, handle)) {
+               talloc_free(p);
                return false;
        }
 
+       talloc_free(p);
+
        return true;
 }