Hi everybody,
I have a problem with memory leaks in the next function. Did I
forgot release any further memory except X509_STORE_free() and
X509_STORE_CTX_free()?
The pCert parameter is released outside this function.
I use OpenSSL 0.9.5a
int CCrypto::SubmitCertificate(const char *szCAfile, X509 *pCert)
{
int result = FALSE;
char Buffer[MAX_PATH];
X509_STORE *cert_ctx = NULL;
X509_STORE_CTX *csc = NULL;
X509_LOOKUP *lookup = NULL;
cert_ctx = X509_STORE_new();
if (cert_ctx == NULL)
goto error;
lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
if (lookup == NULL)
goto error;
result = X509_LOOKUP_load_file(lookup, szCAfile, X509_FILETYPE_PEM);
if (result <= 0)
goto error;
csc = X509_STORE_CTX_new();
if (csc == NULL)
goto error;
X509_STORE_CTX_init(csc, cert_ctx, pCert, NULL);
OpenSSL_add_all_digests();
result = X509_verify_cert(csc);
EVP_cleanup();
if (result < 0)
goto error;
X509_STORE_CTX_free(csc);
X509_STORE_free(cert_ctx);
return TRUE;
error:
ERR_load_crypto_strings();
ERR_error_string(ERR_get_error(), Buffer);
AtlReportError(CLSID_Crypto, Buffer,IID_ICrypto, 0);
ERR_free_strings();
if (csc != NULL)
X509_STORE_CTX_free(csc);
if (cert_ctx != NULL)
X509_STORE_free(cert_ctx);
return FALSE;
}
If someone has an idea .........
Thanks in advance.
-------------------------------
ing. Jiri Holinek
CD s.o. DATIS o.z.
U Tiskarny 3
702 00 Ostrava
Czech Republic
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]