]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix memory leak in cmp_calc_protection()
authorslontis <shane.lontis@oracle.com>
Mon, 27 Jun 2022 23:49:17 +0000 (09:49 +1000)
committerDr. David von Oheimb <dev@ddvo.net>
Wed, 29 Jun 2022 08:02:30 +0000 (10:02 +0200)
Triggered by a  memory allocation failure.
Detected by PR #18355

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/18670)

crypto/cmp/cmp_protect.c

index 93976a7eea545be9bf4d3b5063ae6e7ce91e215c..937b713c23287fce1145d39ab641abffafbb607b 100644 (file)
@@ -91,7 +91,7 @@ ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_CTX *ctx,
             goto end;
 
         if ((prot = ASN1_BIT_STRING_new()) == NULL)
-            return NULL;
+            goto end;
         /* OpenSSL defaults all bit strings to be encoded as ASN.1 NamedBitList */
         prot->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
         prot->flags |= ASN1_STRING_FLAG_BITS_LEFT;