diff options
author | Pauli <ppzgs1@gmail.com> | 2021-03-18 10:31:33 +1000 |
---|---|---|
committer | Pauli <ppzgs1@gmail.com> | 2021-03-20 10:07:59 +1000 |
commit | 316c8dafd4504f595ab7de59d115ce2c46a4f27f (patch) | |
tree | ce20b7f597cf15b2eb0a4f24e1bf2d21ca71cdb9 /test/cmp_asn_test.c | |
parent | 743840d56f165a56b1c4b1e50ce1e8062e49345a (diff) |
test: fix coverity 1454040: resource leak
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14596)
Diffstat (limited to 'test/cmp_asn_test.c')
-rw-r--r-- | test/cmp_asn_test.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/cmp_asn_test.c b/test/cmp_asn_test.c index 33cc03cb4c..c021ed03a6 100644 --- a/test/cmp_asn_test.c +++ b/test/cmp_asn_test.c @@ -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) |