From 74c929d00dce3a4755164859c600aabb3838a87b Mon Sep 17 00:00:00 2001 From: slontis Date: Tue, 28 Jun 2022 09:49:17 +1000 Subject: [PATCH] Fix memory leak in cmp_calc_protection() Triggered by a memory allocation failure. Detected by PR #18355 Reviewed-by: Paul Dale Reviewed-by: David von Oheimb (Merged from https://github.com/openssl/openssl/pull/18670) --- crypto/cmp/cmp_protect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/cmp/cmp_protect.c b/crypto/cmp/cmp_protect.c index 93976a7eea5..937b713c232 100644 --- a/crypto/cmp/cmp_protect.c +++ b/crypto/cmp/cmp_protect.c @@ -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; -- 2.47.2