--=_3f898a05862602ffc722a285118cd0c3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="UTF-8"

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

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

----- Original Message ----
From: Marek.Marcola@malkom.pl
To: openssl-users@openssl.org
Date: Tue, 8 Apr 2008 12:50:07 0200
Subject: RE: CRYPTO_add_lock() segmentation fault (core dump included)=20

Hello,

> Oh
> I forgot to mention that I instantiated those variables (it was like=20

obvious for me).=20
> Here is the initialization code:
>=20
> int Server::TLS_init()
> {
> =C2=A0 =C2=A0 int i;
>=20
> =C2=A0 =C2=A0 mutex_buf =3D (pthread_mutex_t*) malloc(CRYPTO_num_locks() =

*=20
sizeof(pthread_mutex_t));
> =C2=A0 =C2=A0 if (mutex_buf =3D=3D NULL) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -1;
> =C2=A0 =C2=A0 }
> =C2=A0 =C2=A0 for (i =3D 0; i < CRYPTO_num_locks(); i ) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 pthread_mutex_init(&mutex_buf[i], NULL);
> =C2=A0 =C2=A0 }

Maybe changing "i" to "i " may help.

> =C2=A0 =C2=A0 CRYPTO_set_locking_callback(locking_function);
> =C2=A0 =C2=A0 CRYPTO_set_id_callback(id_function);
>=20
> =C2=A0 =C2=A0 SSL_library_init();
> =C2=A0 =C2=A0 SSL_load_error_strings();
>=20
> =C2=A0 =C2=A0 return 0;
> }
>=20
> int Server::TLS_cleanup()
> {
> =C2=A0 =C2=A0 int i;
>=20
> =C2=A0 =C2=A0 if (mutex_buf =3D=3D NULL) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;
> =C2=A0 =C2=A0 }
>=20
> =C2=A0 =C2=A0 CRYPTO_set_locking_callback(NULL);
> =C2=A0 =C2=A0 CRYPTO_set_id_callback(NULL);
>=20
> =C2=A0 =C2=A0 for (i =3D 0; i < CRYPTO_num_locks(); i ) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 pthread_mutex_destroy(&mutex_buf[i]);
> =C2=A0 =C2=A0 }

Maybe changing "i" to "i " may help.

> =C2=A0 =C2=A0 free(mutex_buf);
> =C2=A0 =C2=A0 mutex_buf =3D NULL;
>=20
> =C2=A0 =C2=A0 return 0;
> }


Best regards,
--
Marek Marcola=20

__________________________________________________ ____________________
OpenSSL Project =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 http://www.openssl.or=
g
User Support Mailing List =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0openssl-users@openssl.org
Automated List Manager =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 majordomo@openssl.org


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


__________________________________
Whozin - Are you in?=20
We pay you to read your own e-mail!=20
Primul webmail adev=C4=83rat =C3=AEn limba rom=C3=A2n=C4=83 ! =20

--=_3f898a05862602ffc722a285118cd0c3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="UTF-8"

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

for (=
i =3D 0; i < CRYPTO_num_locks(); i ) {

family: courier; color: #008000">       =
pthread_mutex_init(&mutex_buf[i], NULL);

nt-family: courier; color: #008000">}

----- Original Mess=
age ----
From: Marek.Marcola@malkom.pl
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 variab=
les (it was like
obvious for me).
> Here is the initializati=
on code:
>
> int Server::TLS_init()
> {
> =
    int i;
>
>     mutex_buf =3D (pthr=
ead_mutex_t*) malloc(CRYPTO_num_locks() *
sizeof(pthread_mutex_t)); r />>     if (mutex_buf =3D=3D NULL) {
>    =
    return -1;
>     }
>    =
for (i =3D 0; i < CRYPTO_num_locks(); i ) {
>     &nb=
sp;   pthread_mutex_init(&mutex_buf[i], NULL);
>   &n=
bsp; }
Maybe changing "i" to "i " may help.
=

>     CRYPTO_set_locking_callback(locking_function);
/>>     CRYPTO_set_id_callback(id_function);
>
&=
gt;     SSL_library_init();
>     SSL_load_erro=
r_strings();
>
>     return 0;
> }
=
>
> int Server::TLS_cleanup()
> {
>   &nbs=
p; int i;
>
>     if (mutex_buf =3D=3D NULL) { r />>         return 0;
>     } />>
>     CRYPTO_set_locking_callback(NULL);
&g=
t;     CRYPTO_set_id_callback(NULL);
>
>   =
  for (i =3D 0; i < CRYPTO_num_locks(); i ) {
>   &nbs=
p;     pthread_mutex_destroy(&mutex_buf[i]);
>  =
  }
Maybe changing "i" to "i " may help. />
>     free(mutex_buf);
>     mutex_=
buf =3D NULL;
>
>     return 0;
> }

>
Best regards,
--
Marek Marcola

______________=
__________________________________________________ ______
OpenSSL Proje=
ct                     &n=
bsp;           target=3D"_blank">http://www.openssl.org
User Support Mailing List=
                   opens=
sl-users@openssl.org
Automated List Manager       &nbsp=
;                   majordomo@=
openssl.org

-----------------------------------
Nirvana
>


__________________________________


Whozin=
- Are you in?

We pay you to read your own e-mail!

Primul webmail adev=C4=83rat =C3=AEn limba rom=C3=A2n=C4=83!

--=_3f898a05862602ffc722a285118cd0c3--
__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majordomo@openssl.org