summaryrefslogtreecommitdiffstats
path: root/crypto/cmp
diff options
context:
space:
mode:
authorslontis <shane.lontis@oracle.com>2022-06-28 09:49:17 +1000
committerDr. David von Oheimb <dev@ddvo.net>2022-06-29 10:02:30 +0200
commit74c929d00dce3a4755164859c600aabb3838a87b (patch)
treedb1024d103d32fa7371b3653cef0570df4f94c2b /crypto/cmp
parent8eca6864e080c9b8197fec81cd6f327be43bb14c (diff)
Fix memory leak in cmp_calc_protection()
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)
Diffstat (limited to 'crypto/cmp')
-rw-r--r--crypto/cmp/cmp_protect.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/cmp/cmp_protect.c b/crypto/cmp/cmp_protect.c
index 93976a7eea..937b713c23 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;