diff options
author | JAVAID Mohammad-Habib <mohammad-habib.javaid@etud.univ-paris8.fr> | 2023-02-28 21:07:59 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2023-03-20 19:02:44 +0100 |
commit | c9c99018a887bfac1fe5a5ae6dcd8a5647494504 (patch) | |
tree | f4c6ec973f7ff5ef06cc8cb5d4091792fcb529e2 /crypto | |
parent | e9460bb45b38e9edb6a57b79daeefdc80eb9e81f (diff) |
cmp_msg.c: free memory of certStatus before goto err
CLA: trivial
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20406)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/cmp/cmp_msg.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/cmp/cmp_msg.c b/crypto/cmp/cmp_msg.c index 619cf7b78b..64c83d6e34 100644 --- a/crypto/cmp/cmp_msg.c +++ b/crypto/cmp/cmp_msg.c @@ -817,8 +817,10 @@ OSSL_CMP_MSG *ossl_cmp_certConf_new(OSSL_CMP_CTX *ctx, int fail_info, if ((certStatus = OSSL_CMP_CERTSTATUS_new()) == NULL) goto err; /* consume certStatus into msg right away so it gets deallocated with msg */ - if (!sk_OSSL_CMP_CERTSTATUS_push(msg->body->value.certConf, certStatus)) + if (sk_OSSL_CMP_CERTSTATUS_push(msg->body->value.certConf, certStatus) < 1) { + OSSL_CMP_CERTSTATUS_free(certStatus); goto err; + } /* set the ID of the certReq */ if (!ASN1_INTEGER_set(certStatus->certReqId, OSSL_CMP_CERTREQID)) goto err; |