mirror of
https://github.com/openssl/openssl.git
synced 2024-12-14 12:34:02 +08:00
CMS_add1_crl(): prevent double free on failure of CMS_add0_crl()
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/19199)
This commit is contained in:
parent
ee58915cfd
commit
6f9e531003
@ -620,11 +620,12 @@ int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl)
|
||||
|
||||
int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl)
|
||||
{
|
||||
int r;
|
||||
r = CMS_add0_crl(cms, crl);
|
||||
if (r > 0)
|
||||
X509_CRL_up_ref(crl);
|
||||
return r;
|
||||
if (!X509_CRL_up_ref(crl))
|
||||
return 0;
|
||||
if (CMS_add0_crl(cms, crl))
|
||||
return 1;
|
||||
X509_CRL_free(crl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms)
|
||||
|
Loading…
Reference in New Issue
Block a user