[openssl-dev] memory leaks detected using libSSL 1.1

Michel michel.sales at free.fr
Sun Feb 14 00:11:01 UTC 2016


Hi Matt,

Thanks for your quick answer.
I applied your patch and it fixes the leaks found in the simple test
program.

However, a more complex one, still report [other] leaks.

Below is a new log if you can have a look at them.
I will investigate deeper tomorrow concering 1.0.2.

Thanks again, 

Michel.

Detected memory leaks!
Dumping objects ->
{4383} normal block at 0x006472C8, 8 bytes long.
 Data: <        > 00 00 00 00 01 00 00 00 
{4381} normal block at 0x00646B48, 12 bytes long.
 Data: < od      }  > D8 6F 64 00 00 00 00 00 20 7D 00 00 
{4379} normal block at 0x00647248, 64 bytes long.
 Data: <Hkd             > 48 6B 64 00 00 00 00 00 00 00 00 00 00 00 00 00 
{4377} normal block at 0x006471A8, 96 bytes long.
 Data: <Hrd     0       > 48 72 64 00 10 03 A5 00 30 03 A5 00 08 00 00 00 
{4375} normal block at 0x00646FD8, 400 bytes long.
 Data: <                > 00 00 00 00 A0 09 00 00 00 00 00 00 00 00 00 00 
Object dump complete.

WARNING: Visual Leak Detector detected memory leaks!
---------- Block 4363 at 0x00646B48: 12 bytes ----------
  Leak Hash: 0xF7E93E2A, Count: 1, Total 12 bytes
  Call Stack (TID 2464):
    ntdll.dll!RtlAllocateHeap()
    f:\dd\vctools\crt\crtw32\misc\dbgmalloc.c (56): TestsTLS-11.exe!malloc()
+ 0x15 bytes
    e:\openssl-1.1.git\crypto\mem.c (138): TestsTLS-11.exe!CRYPTO_malloc() +
0x9 bytes
    e:\openssl-1.1.git\crypto\lhash\lhash.c (168):
TestsTLS-11.exe!lh_insert() + 0xB bytes
    e:\openssl-1.1.git\crypto\err\err_lcl.h (2):
TestsTLS-11.exe!lh_ERR_STATE_insert() + 0x10 bytes
    e:\openssl-1.1.git\crypto\err\err.c (371):
TestsTLS-11.exe!int_thread_set_item() + 0xD bytes
    e:\openssl-1.1.git\crypto\err\err.c (884):
TestsTLS-11.exe!ERR_get_state() + 0xC bytes
    e:\openssl-1.1.git\crypto\err\err.c (598):
TestsTLS-11.exe!ERR_clear_error() + 0x5 bytes
    e:\openssl-1.1.git\ssl\statem\statem.c (279):
TestsTLS-11.exe!state_machine()
    e:\openssl-1.1.git\ssl\statem\statem.c (217):
TestsTLS-11.exe!ossl_statem_connect() + 0xB bytes
    e:\openssl-1.1.git\ssl\ssl_lib.c (2908):
TestsTLS-11.exe!SSL_do_handshake() + 0xC bytes
    p:\mes programmes\shared\ocrypto-11\tls.cpp (1017):
TestsTLS-11.exe!OTLS::TLSSss::DoHandshake() + 0xC bytes
    p:\mes programmes\tests\_testsshared\teststls-11-leak\clttasks.cpp (63):
TestsTLS-11.exe!CltThread::Main() + 0xB bytes
    p:\mes programmes\shared\sthread.cpp (17):
TestsTLS-11.exe!SThread::Run() + 0xE bytes
    f:\dd\vctools\crt\crtw32\startup\threadex.c (359):
TestsTLS-11.exe!_threadstartex()

---------- Block 4357 at 0x00646FD8: 400 bytes ----------
  Leak Hash: 0xC22F7275, Count: 1, Total 400 bytes
  Call Stack (TID 2464):
    ntdll.dll!RtlAllocateHeap()
    f:\dd\vctools\crt\crtw32\misc\dbgmalloc.c (56): TestsTLS-11.exe!malloc()
+ 0x15 bytes
    e:\openssl-1.1.git\crypto\mem.c (138): TestsTLS-11.exe!CRYPTO_malloc() +
0x9 bytes
    e:\openssl-1.1.git\crypto\err\err.c (874):
TestsTLS-11.exe!ERR_get_state() + 0xE bytes
    e:\openssl-1.1.git\crypto\err\err.c (598):
TestsTLS-11.exe!ERR_clear_error() + 0x5 bytes
    e:\openssl-1.1.git\ssl\statem\statem.c (279):
TestsTLS-11.exe!state_machine()
    e:\openssl-1.1.git\ssl\statem\statem.c (217):
TestsTLS-11.exe!ossl_statem_connect() + 0xB bytes
    e:\openssl-1.1.git\ssl\ssl_lib.c (2908):
TestsTLS-11.exe!SSL_do_handshake() + 0xC bytes
    p:\mes programmes\shared\ocrypto-11\tls.cpp (1017):
TestsTLS-11.exe!OTLS::TLSSss::DoHandshake() + 0xC bytes
    p:\mes programmes\tests\_testsshared\teststls-11-leak\clttasks.cpp (63):
TestsTLS-11.exe!CltThread::Main() + 0xB bytes
    p:\mes programmes\shared\sthread.cpp (17):
TestsTLS-11.exe!SThread::Run() + 0xE bytes
    f:\dd\vctools\crt\crtw32\startup\threadex.c (359):
TestsTLS-11.exe!_threadstartex()

---------- Block 4359 at 0x006471A8: 96 bytes ----------
  Leak Hash: 0x1DBDD4B0, Count: 1, Total 96 bytes
  Call Stack (TID 2464):
    ntdll.dll!RtlAllocateHeap()
    f:\dd\vctools\crt\crtw32\misc\dbgmalloc.c (56): TestsTLS-11.exe!malloc()
+ 0x15 bytes
    e:\openssl-1.1.git\crypto\mem.c (138): TestsTLS-11.exe!CRYPTO_malloc() +
0x9 bytes
    e:\openssl-1.1.git\crypto\mem.c (158): TestsTLS-11.exe!CRYPTO_zalloc() +
0x11 bytes
    e:\openssl-1.1.git\crypto\lhash\lhash.c (116): TestsTLS-11.exe!lh_new()
+ 0xB bytes
    e:\openssl-1.1.git\crypto\err\err_lcl.h (2):
TestsTLS-11.exe!lh_ERR_STATE_new() + 0x10 bytes
    e:\openssl-1.1.git\crypto\err\err.c (321):
TestsTLS-11.exe!int_thread_get() + 0xF bytes
    e:\openssl-1.1.git\crypto\err\err.c (369):
TestsTLS-11.exe!int_thread_set_item() + 0x9 bytes
    e:\openssl-1.1.git\crypto\err\err.c (884):
TestsTLS-11.exe!ERR_get_state() + 0xC bytes
    e:\openssl-1.1.git\crypto\err\err.c (598):
TestsTLS-11.exe!ERR_clear_error() + 0x5 bytes
    e:\openssl-1.1.git\ssl\statem\statem.c (279):
TestsTLS-11.exe!state_machine()
    e:\openssl-1.1.git\ssl\statem\statem.c (217):
TestsTLS-11.exe!ossl_statem_connect() + 0xB bytes
    e:\openssl-1.1.git\ssl\ssl_lib.c (2908):
TestsTLS-11.exe!SSL_do_handshake() + 0xC bytes
    p:\mes programmes\shared\ocrypto-11\tls.cpp (1017):
TestsTLS-11.exe!OTLS::TLSSss::DoHandshake() + 0xC bytes
    p:\mes programmes\tests\_testsshared\teststls-11-leak\clttasks.cpp (63):
TestsTLS-11.exe!CltThread::Main() + 0xB bytes
    p:\mes programmes\shared\sthread.cpp (17):
TestsTLS-11.exe!SThread::Run() + 0xE bytes
    f:\dd\vctools\crt\crtw32\startup\threadex.c (359):
TestsTLS-11.exe!_threadstartex()

---------- Block 4361 at 0x00647248: 64 bytes ----------
  Leak Hash: 0x713FD291, Count: 1, Total 64 bytes
  Call Stack (TID 2464):
    ntdll.dll!RtlAllocateHeap()
    f:\dd\vctools\crt\crtw32\misc\dbgmalloc.c (56): TestsTLS-11.exe!malloc()
+ 0x15 bytes
    e:\openssl-1.1.git\crypto\mem.c (138): TestsTLS-11.exe!CRYPTO_malloc() +
0x9 bytes
    e:\openssl-1.1.git\crypto\mem.c (158): TestsTLS-11.exe!CRYPTO_zalloc() +
0x11 bytes
    e:\openssl-1.1.git\crypto\lhash\lhash.c (118): TestsTLS-11.exe!lh_new()
+ 0xB bytes
    e:\openssl-1.1.git\crypto\err\err_lcl.h (2):
TestsTLS-11.exe!lh_ERR_STATE_new() + 0x10 bytes
    e:\openssl-1.1.git\crypto\err\err.c (321):
TestsTLS-11.exe!int_thread_get() + 0xF bytes
    e:\openssl-1.1.git\crypto\err\err.c (369):
TestsTLS-11.exe!int_thread_set_item() + 0x9 bytes
    e:\openssl-1.1.git\crypto\err\err.c (884):
TestsTLS-11.exe!ERR_get_state() + 0xC bytes
    e:\openssl-1.1.git\crypto\err\err.c (598):
TestsTLS-11.exe!ERR_clear_error() + 0x5 bytes
    e:\openssl-1.1.git\ssl\statem\statem.c (279):
TestsTLS-11.exe!state_machine()
    e:\openssl-1.1.git\ssl\statem\statem.c (217):
TestsTLS-11.exe!ossl_statem_connect() + 0xB bytes
    e:\openssl-1.1.git\ssl\ssl_lib.c (2908):
TestsTLS-11.exe!SSL_do_handshake() + 0xC bytes
    p:\mes programmes\shared\ocrypto-11\tls.cpp (1017):
TestsTLS-11.exe!OTLS::TLSSss::DoHandshake() + 0xC bytes
    p:\mes programmes\tests\_testsshared\teststls-11-leak\clttasks.cpp (63):
TestsTLS-11.exe!CltThread::Main() + 0xB bytes
    p:\mes programmes\shared\sthread.cpp (17):
TestsTLS-11.exe!SThread::Run() + 0xE bytes
    f:\dd\vctools\crt\crtw32\startup\threadex.c (359):
TestsTLS-11.exe!_threadstartex()

---------- Block 4365 at 0x006472C8: 8 bytes ----------
  Leak Hash: 0xFBE574AD, Count: 1, Total 8 bytes
  Call Stack (TID 2464):
    ntdll.dll!RtlAllocateHeap()
    f:\dd\vctools\crt\crtw32\misc\dbgmalloc.c (56): TestsTLS-11.exe!malloc()
+ 0x15 bytes
    e:\openssl-1.1.git\crypto\mem.c (138): TestsTLS-11.exe!CRYPTO_malloc() +
0x9 bytes
    e:\openssl-1.1.git\crypto\mem.c (158): TestsTLS-11.exe!CRYPTO_zalloc() +
0x11 bytes
    e:\openssl-1.1.git\crypto\init.c (197):
TestsTLS-11.exe!ossl_init_get_thread_local() + 0xB bytes
    e:\openssl-1.1.git\crypto\init.c (511):
TestsTLS-11.exe!ossl_init_thread_start() + 0x7 bytes
    e:\openssl-1.1.git\crypto\err\err.c (898):
TestsTLS-11.exe!ERR_get_state() + 0x9 bytes
    e:\openssl-1.1.git\crypto\err\err.c (598):
TestsTLS-11.exe!ERR_clear_error() + 0x5 bytes
    e:\openssl-1.1.git\ssl\statem\statem.c (279):
TestsTLS-11.exe!state_machine()
    e:\openssl-1.1.git\ssl\statem\statem.c (217):
TestsTLS-11.exe!ossl_statem_connect() + 0xB bytes
    e:\openssl-1.1.git\ssl\ssl_lib.c (2908):
TestsTLS-11.exe!SSL_do_handshake() + 0xC bytes
    p:\mes programmes\shared\ocrypto-11\tls.cpp (1017):
TestsTLS-11.exe!OTLS::TLSSss::DoHandshake() + 0xC bytes
    p:\mes programmes\tests\_testsshared\teststls-11-leak\clttasks.cpp (63):
TestsTLS-11.exe!CltThread::Main() + 0xB bytes
    p:\mes programmes\shared\sthread.cpp (17):
TestsTLS-11.exe!SThread::Run() + 0xE bytes
    f:\dd\vctools\crt\crtw32\startup\threadex.c (359):
TestsTLS-11.exe!_threadstartex()

Visual Leak Detector detected 5 memory leaks (10757 bytes).
Largest number used: 213916 bytes.
Total allocations: 902180 bytes.
Visual Leak Detector is now exiting.

-----Message d'origine-----
De : openssl-dev [mailto:openssl-dev-bounces at openssl.org] De la part de Matt
Caswell
Envoyé : dimanche 14 février 2016 00:30
À : openssl-dev at openssl.org
Objet : Re: [openssl-dev] memory leaks detected using libSSL 1.1

Hmmm. It does look to me like there could be a memory leak here. What's not
clear to me is to why you are only seeing this in 1.1 and not previous
versions, as it looks like the same could happen in 1.0.2 as well!

Anyway, please try the attached patch to see if that helps.

Let me know how you get on.

Thanks

Matt




More information about the openssl-dev mailing list