libcli/ldap: Fix CID 1462695 Resource leak
authorVolker Lendecke <vl@samba.org>
Wed, 5 Aug 2020 09:25:27 +0000 (11:25 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 6 Aug 2020 19:00:36 +0000 (19:00 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libcli/ldap/tests/ldap_message_test.c

index 5ac7f2ef9a94e4ab889d735f4c971578d004ec1e..4050b7f1cb103ed1b5d88cdfe859c97ca784338d 100644 (file)
@@ -197,6 +197,7 @@ static void test_recursion_depth_equals_max(void **state)
        uint8_t *buffer = NULL;
        const size_t BUFF_SIZE = 1048576;
        size_t len;
+       int ret;
        struct ldap_request_limits limits = {
                .max_search_size = 256000,
        };
@@ -219,6 +220,10 @@ static void test_recursion_depth_equals_max(void **state)
        status = ldap_decode(
                asn1, &limits, samba_ldap_control_handlers(), ldap_msg);
        assert_true(NT_STATUS_IS_OK(status));
+
+       ret = fclose(f);
+       f = NULL;
+       assert_true(ret == 0);
 }
 
 /*