summaryrefslogtreecommitdiffstats
path: root/crypto/cmp
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-12-07 17:49:05 +0100
committerDr. David von Oheimb <dev@ddvo.net>2021-12-09 07:44:29 +0100
commitd580c2790f9f304533a3eda2a9cf6b8eb22830c3 (patch)
treed41e72d0245c5a05734f2e17817cf1b5ee022dc1 /crypto/cmp
parentf5485b97b6c9977c0d39c7669b9f97a879312447 (diff)
OSSL_CMP_MSG_read(): Fix mem leak on file read error
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17225)
Diffstat (limited to 'crypto/cmp')
-rw-r--r--crypto/cmp/cmp_msg.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/cmp/cmp_msg.c b/crypto/cmp/cmp_msg.c
index 51b0998bdc..0497155e09 100644
--- a/crypto/cmp/cmp_msg.c
+++ b/crypto/cmp/cmp_msg.c
@@ -1100,9 +1100,8 @@ OSSL_CMP_MSG *OSSL_CMP_MSG_read(const char *file, OSSL_LIB_CTX *libctx,
return NULL;
}
- if ((bio = BIO_new_file(file, "rb")) == NULL)
- return NULL;
- if (d2i_OSSL_CMP_MSG_bio(bio, &msg) == NULL) {
+ if ((bio = BIO_new_file(file, "rb")) == NULL
+ || d2i_OSSL_CMP_MSG_bio(bio, &msg) == NULL) {
OSSL_CMP_MSG_free(msg);
msg = NULL;
}