Sorry but Tim Hudson said me the answer previously,  so now I know what's
the problem.
Thanks.

2008/9/11 Darryl Miles <[EMAIL PROTECTED]>

> nicolas sitbon wrote:
>
>> Hi, I'm currently developping an application using libcrypto, I find some
>> memory leak with valgrind (please don't say me to compile with -DPURIFY, I
>> know that and in fact, my problem is not uninitialized data, but rather
>> memory leak) :
>>
>> ==26823== 1,552 (168 direct, 1,384 indirect) bytes in 1 blocks are
>> definitely lost in loss record 1 of 2
>> ==26823==    at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
>> ==26823==    by 0x40ACB2: CRYPTO_malloc (in /home/nicolas/admkey)
>> ==26823==    by 0x41CBBA: RSA_new_method (in /home/nicolas/admkey)
>> ==26823==    by 0x41CECC: rsa_cb (in /home/nicolas/admkey)
>>
> ...SNIP...
>
>  ==26823== 1,384 bytes in 16 blocks are indirectly lost in loss record 2 of
>> 2
>> ==26823==    at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
>> ==26823==    by 0x40ACB2: CRYPTO_malloc (in /home/nicolas/admkey)
>> ==26823==    by 0x413F37: BN_new (in /home/nicolas/admkey)
>>
> ...SNIP...
>
>>
>> I call PEM_read_RSAPrivateKey() as you can see
>>
>
> And did you get a valid "RSA *" object returned ?
>
> Did you call "RSA_free()" with that returned object (before starting your
> cleanup) ?
>
> If this proves to be the issue: The OpenSSL library cleanup is there to
> clean up objects that have been created for internal use within the library.
>  Many of these objects do not come into direct use by application code
> during normal running, so there is a clear case for OpenSSL cleanup code
> "undoing" what it did in this regard.  Objects which the application created
> and held onto are not managed in the same way, the application is expected
> to manage their lifecycle and explicitly call their respective destruction
> functions.
>
>
> I've also downloaded the latest snapshot,
>
>> but it seems that this problem is not currently fix.
>> I have also check in the documentation of PEM_read_RSAPrivateKey(), but
>> nothing says how to free this memory.
>>
>
> Since it is an "RSA *" then did you try "man RSA_free" ?
>
>
> Darryl
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       openssl-dev@openssl.org
> Automated List Manager                           [EMAIL PROTECTED]
>

Reply via email to