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:07:28 +0100 |
commit | 63798895df75bb153f76961d9ae9219c1d9de360 (patch) | |
tree | 75eb8e7763b1d1fc60792d12b9c62d2781ac7305 /crypto/cmp | |
parent | 21c9a485e7b55fef3bf0f008cb97f4dfbade9a4b (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)
(cherry picked from commit c9c99018a887bfac1fe5a5ae6dcd8a5647494504)
Diffstat (limited to 'crypto/cmp')
-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 b244f1e17f..d341889a01 100644 --- a/crypto/cmp/cmp_msg.c +++ b/crypto/cmp/cmp_msg.c @@ -816,8 +816,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; |