summaryrefslogtreecommitdiffstats
path: root/crypto/cmp/cmp_msg.c
diff options
context:
space:
mode:
authorJAVAID Mohammad-Habib <mohammad-habib.javaid@etud.univ-paris8.fr>2023-02-28 21:07:59 +0100
committerTomas Mraz <tomas@openssl.org>2023-03-20 19:07:18 +0100
commit37820d07916fefad02b45fdcd63dde8d881043cd (patch)
tree8a04db51722083eab42fa1c4c39bc2944ecbaa8c /crypto/cmp/cmp_msg.c
parentf0bb166cb6c972247568c5e6a12f71dcda839c1d (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/cmp_msg.c')
-rw-r--r--crypto/cmp/cmp_msg.c4
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;