Richard,
Let me give me more details about this issue. I am using another
library libcurl that uses openssl. After initialization and proper
cleanup of CURL handles, I detect this memory leak. I contacted
libcurl developers and they suggested that libcrypto is doing some
global initializations (that include calling ENGINE_new) as the
previous post shows. However, libcrypto seems to be not cleaning up
after itself. A solution to this issue could be by having libcurl
developers call a global cleanup function of libcrypto in their
cleanup functions. Does such a function that cleans up the global
memory allocations done in libcrypto exist?

Thanks,
Huzaifa


On Thu, Dec 25, 2008 at 2:30 PM, Richard Levitte via RT <[email protected]> 
wrote:
> Looks like you called ENGINE_new().  Did you do a corresponding call to
> ENGINE_free()?
>
>> [[email protected] - Tue Dec 23 09:07:34 2008]:
>>
>> Greetings,
>> I used OPENSSL in a project and it is leading to memory leak. Although
>> this is not significantly harmful, I believe that there should be a
>> function that can free all allocated memory before the application
>> quits. I tried all the functions that were suggested in the FAQ and
>> the memory leak is still reported.
>> The functions that I tried for freeing this memory are:
>>   CONF_modules_free();
>>   ERR_remove_state(0);
>>
>>
>>   ENGINE_cleanup();
>>   CONF_modules_unload(1);
>>
>>   ERR_free_strings();
>>   EVP_cleanup();
>>   CRYPTO_cleanup_all_ex_data();
>>
>> And still the memory leak is reported.
>>
>> I am using openssl-0.9.8e.
>>
>> The memory leak is traced to: ENGINE_new in libcrypto
>> 276 bytes in 7 blocks are still reachable in loss record 1 of 1
>>    at 0x40204E5: malloc (in /usr/lib/valgrind/x86-
>> linux/vgpreload_memcheck.so)
>>    by 0x43CEF0B: (within /usr/lib/libcrypto.so.0.9.8)
>>    by 0x43CF5A3: CRYPTO_malloc (in /usr/lib/libcrypto.so.0.9.8)
>>    by 0x442B58D: ENGINE_new (in /usr/lib/libcrypto.so.0.9.8)
>>    by 0x408FF8F: (below main) (in /lib/i686/libc-2.6.1.so)
>>
>> Is this a known issue,  or is there any other function that can be
>> used to free memory before the application quits?
>>
>> Thanks,
>> Huzaifa
>>
>>
> --
> Richard Levitte
> [email protected]
>


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

Reply via email to