On 29 Apr 00, at 18:54, [EMAIL PROTECTED] wrote:


add: lh_free((LHASH*)ERR_get_err_state_table());
at the end of the cleanup.

Dror



>  VC6.0 detected memory leaks in the following code! And the code do
>  only PEM_read_bio_PrivateKey()!!
> 
> When I enabled the OpenSSL_add_ssl_algorithms() and the
> PEM_read_bio_PrivateKey () finished sucessful, there is no memory
> leaks. But when I disable(comment out) the
> Openssl_add_ssl_algorithms() and the PEM_read_bio_PrivateKey() failed,
> the following code caused memory leaks. As the code showed, I have
> called ERR_clear_error(), ERR_remove_state(0), EVP_cleanup(), and
> ERR_free_strings(), but the memory leaks still exists!!
> 
> 
>  EVP_PKEY* pKey = NULL;
>  BIO *in = NULL;
>  char filename[] = "ca\\cakey.pem";
>  char passwd[] = "passwd";
> 
>  if ((in = BIO_new(BIO_s_file())) == NULL)
>   TRACE("cannot create a bio!\n");
> 
>  if (BIO_read_filename(in, filename) <= 0)
>   TRACE("cannot open file\n");
> 
>  //OpenSSL_add_ssl_algorithms();
>  SSL_load_error_strings();
> 
>  pKey = PEM_read_bio_PrivateKey(in,NULL,NULL, passwd);
> 
>  FILE *fp = fopen("memleaks.txt", "w+");
>  ERR_print_errors_fp(fp);
>  fclose(fp);
> 
>  ERR_clear_error();
> 
>  ERR_remove_state(0);
>  EVP_cleanup();
> 
>  ERR_free_strings();
> 
>  if (pKey != NULL)
>   EVP_PKEY_free(pKey);
> 
>  if (in != NULL)
>   BIO_free(in);
> 
> Anyone have an idea?
> 
> zhang
> -------------------------------------
> 欢迎使用北京电报局的免费电子邮件系统!
>  http://btamail.net.cn  or http://mail.bta.net.cn
> 客服中心电话:223 (免费)
> 欢迎拨169上网,电话:169,用户名:169,口令:169.
> 
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]
> 


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to