coverity 1520505: error handling
authorPauli <pauli@openssl.org>
Wed, 25 Jan 2023 01:06:09 +0000 (12:06 +1100)
committerPauli <pauli@openssl.org>
Sun, 29 Jan 2023 21:34:16 +0000 (08:34 +1100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/20132)

test/cmp_hdr_test.c

index 9e041db1a085521bba8ca7bbc67dc42ac9c649de..c4cab22f5f7e53126806d1dd8088939668d30320 100644 (file)
@@ -333,12 +333,12 @@ execute_HDR_generalInfo_push1_items_test(CMP_HDR_TEST_FIXTURE *fixture)
     if (!TEST_ptr(asn1int))
         return 0;
 
-    if (!TEST_ptr(val)) {
+    if (!TEST_ptr(val)
+            || !TEST_true(ASN1_INTEGER_set(asn1int, 88))) {
         ASN1_INTEGER_free(asn1int);
         return 0;
     }
 
-    ASN1_INTEGER_set(asn1int, 88);
     ASN1_TYPE_set(val, V_ASN1_INTEGER, asn1int);
     if (!TEST_ptr(itav = OSSL_CMP_ITAV_create(OBJ_txt2obj(oid, 1), val))) {
         ASN1_TYPE_free(val);