diff --git a/engines/e_capi.c b/engines/e_capi.c index f06d298324a6f293b500e386fb07e7ad9bea20c8..edcebf1a3f1cd5a60a0fea75735f784716f460eb 100644 --- a/engines/e_capi.c +++ b/engines/e_capi.c @@ -1333,6 +1333,8 @@ char * capi_cert_get_fname(CAPI_CTX *ctx, PCCERT_CONTEXT cert) if (!CertGetCertificateContextProperty(cert, CERT_FRIENDLY_NAME_PROP_ID, NULL, &dlen)) return NULL; wfname = OPENSSL_malloc(dlen); + if (wfname == NULL) + return NULL; if (CertGetCertificateContextProperty(cert, CERT_FRIENDLY_NAME_PROP_ID, wfname, &dlen)) { char *fname = wide_to_asc(wfname);