Skip to content

Commit

Permalink
cmp_msg.c: free memory of certStatus before goto err
Browse files Browse the repository at this point in the history
CLA: trivial

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #20406)

(cherry picked from commit c9c9901)
  • Loading branch information
JAVAID Mohammad-Habib authored and t8m committed Mar 20, 2023
1 parent f0bb166 commit 37820d0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crypto/cmp/cmp_msg.c
Expand Up @@ -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;
Expand Down

0 comments on commit 37820d0

Please sign in to comment.