test: fix coverity 1454040: resource leak

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14596)
This commit is contained in:
Pauli 2021-03-18 10:31:33 +10:00
parent 743840d56f
commit 316c8dafd4

View File

@ -42,12 +42,15 @@ static void tear_down(CMP_ASN_TEST_FIXTURE *fixture)
static int execute_cmp_asn1_get_int_test(CMP_ASN_TEST_FIXTURE *fixture)
{
int res;
ASN1_INTEGER *asn1integer = ASN1_INTEGER_new();
ASN1_INTEGER_set(asn1integer, 77);
if (!TEST_int_eq(77, ossl_cmp_asn1_get_int(asn1integer)))
if (!TEST_ptr(asn1integer))
return 0;
ASN1_INTEGER_set(asn1integer, 77);
res = TEST_int_eq(77, ossl_cmp_asn1_get_int(asn1integer));
ASN1_INTEGER_free(asn1integer);
return 1;
return res;
}
static int test_cmp_asn1_get_int(void)