diff options
| author | Enji Cooper <ngie@FreeBSD.org> | 2026-06-09 19:21:35 +0000 |
|---|---|---|
| committer | Enji Cooper <ngie@FreeBSD.org> | 2026-06-09 19:21:35 +0000 |
| commit | 3a71a35ad9dad0e5d2cad8efecc8ba9d57c42d43 (patch) | |
| tree | 4f5b47534bc1016b89e70bd6dc27382670adcee5 /apps/lib/apps.c | |
| parent | ab5fc4ac933ff67bc800e774dffce15e2a541e90 (diff) | |
Diffstat (limited to 'apps/lib/apps.c')
| -rw-r--r-- | apps/lib/apps.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/lib/apps.c b/apps/lib/apps.c index bc2e1c123a75..e5a2b162b4ef 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -1057,9 +1057,12 @@ int load_key_certs_crls(const char *uri, int format, int maybe_stdin, if (ok) pcert = NULL; } else if (pcerts != NULL) { - ok = X509_add_cert(*pcerts, - OSSL_STORE_INFO_get1_CERT(info), - X509_ADD_FLAG_DEFAULT); + X509 *cert = OSSL_STORE_INFO_get1_CERT(info); + + ok = cert != NULL + && X509_add_cert(*pcerts, cert, X509_ADD_FLAG_DEFAULT); + if (!ok) + X509_free(cert); } ncerts += ok; break; @@ -1069,7 +1072,11 @@ int load_key_certs_crls(const char *uri, int format, int maybe_stdin, if (ok) pcrl = NULL; } else if (pcrls != NULL) { - ok = sk_X509_CRL_push(*pcrls, OSSL_STORE_INFO_get1_CRL(info)); + X509_CRL *crl = OSSL_STORE_INFO_get1_CRL(info); + + ok = crl != NULL && sk_X509_CRL_push(*pcrls, crl); + if (!ok) + X509_CRL_free(crl); } ncrls += ok; break; |
