libcli/ldap: Fix CID 1462696 Resource leak
authorVolker Lendecke <vl@samba.org>
Wed, 5 Aug 2020 09:23:30 +0000 (11:23 +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 4ffdb3bb4777c6d8a28e039f7f96572b3fe15fbc..5ac7f2ef9a94e4ab889d735f4c971578d004ec1e 100644 (file)
@@ -237,6 +237,7 @@ static void test_recursion_depth_greater_than_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,
        };
@@ -259,6 +260,10 @@ static void test_recursion_depth_greater_than_max(void **state)
        status = ldap_decode(
                asn1, &limits, samba_ldap_control_handlers(), ldap_msg);
        assert_ldap_status_equal(LDAP_PROTOCOL_ERROR, status);
+
+       ret = fclose(f);
+       f = NULL;
+       assert_true(ret == 0);
 }
 
 /*