Yes! There was an mistake when I copied the code. There is i as you said.

for (i = 0; i  <  CRYPTO_num_locks(); i ) {
        pthread_mutex_init(&mutex_buf[i], NULL);
}

----- Original Message ----
From: [EMAIL PROTECTED]
To: openssl-users@openssl.org
Date: Tue, 8 Apr 2008 12:50:07 0200
Subject: RE: CRYPTO_add_lock() segmentation fault (core dump included) 

Hello,

> Oh :)
> I forgot to mention that I instantiated those variables (it was like 
obvious for me). 
> Here is the initialization code:
> 
> int Server::TLS_init()
> {
>     int i;
> 
>     mutex_buf = (pthread_mutex_t*) malloc(CRYPTO_num_locks() * 
sizeof(pthread_mutex_t));
>     if (mutex_buf == NULL) {
>         return -1;
>     }
>     for (i = 0; i  <  CRYPTO_num_locks(); i ) {
>         pthread_mutex_init(&mutex_buf[i], NULL);
>     }
Maybe changing "i" to "i " may help.

>     CRYPTO_set_locking_callback(locking_function);
>     CRYPTO_set_id_callback(id_function);
> 
>     SSL_library_init();
>     SSL_load_error_strings();
> 
>     return 0;
> }
> 
> int Server::TLS_cleanup()
> {
>     int i;
> 
>     if (mutex_buf == NULL) {
>         return 0;
>     }
> 
>     CRYPTO_set_locking_callback(NULL);
>     CRYPTO_set_id_callback(NULL);
> 
>     for (i = 0; i  <  CRYPTO_num_locks(); i ) {
>         pthread_mutex_destroy(&mutex_buf[i]);
>     }
Maybe changing "i" to "i " may help.

>     free(mutex_buf);
>     mutex_buf = NULL;
> 
>     return 0;
> }

Best regards,
--
Marek Marcola 

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


-----------------------------------
Nirvana


__________________________________
Whozin  - Are you in? 
We pay  you  to read your own e-mail! 
Primul webmail adevărat în  limba română !   

Reply via email to