Leaks in Initialization of library 0.9.8 i compiled with VC 7.1under Windows - Openssl

This is a discussion on Leaks in Initialization of library 0.9.8 i compiled with VC 7.1under Windows - Openssl ; CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); SSLeay_add_ssl_algorithms(); SSL_load_error_strings(); ERR_remove_state(0); ERR_free_strings(); EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); ENGINE_cleanup(); CONF_modules_unload(1); This code makes leaks about hundred of bytes. It is only in this version or older versions makes this too? or i did something wrong? -- Best Regards, Stanislav Mikhailenko __________________________________________________ ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Leaks in Initialization of library 0.9.8 i compiled with VC 7.1under Windows

  1. Leaks in Initialization of library 0.9.8 i compiled with VC 7.1under Windows

    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
    SSLeay_add_ssl_algorithms();
    SSL_load_error_strings();
    ERR_remove_state(0);
    ERR_free_strings();
    EVP_cleanup();
    CRYPTO_cleanup_all_ex_data();
    ENGINE_cleanup();
    CONF_modules_unload(1);

    This code makes leaks about hundred of bytes. It is only in this version
    or older versions makes this too? or i did something wrong?

    --
    Best Regards,
    Stanislav Mikhailenko
    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    User Support Mailing List openssl-users@openssl.org
    Automated List Manager majordomo@openssl.org


  2. Re: Leaks in Initialization of library 0.9.8 i compiled with VC7.1 under Windows



    ==13777== 128 bytes in 1 blocks are still reachable in loss record 1 of 2
    ==13777== at 0x4004BEC: realloc (vg_replace_malloc.c:306)
    ==13777== by 0x8052515: default_realloc_ex (mem.c:86)
    ==13777== by 0x8052B3E: CRYPTO_realloc (mem.c:331)
    ==13777== by 0x8062B64: contract (lhash.c:369)
    ==13777== by 0x8062873: lh_delete (lhash.c:243)
    ==13777== by 0x8053581: CRYPTO_dbg_free (mem_dbg.c:519)
    ==13777== by 0x8052C81: CRYPTO_free (mem.c:374)
    ==13777== by 0x80552AA: OBJ_NAME_remove (o_names.c:251)
    ==13777== by 0x8055498: names_lh_free (o_names.c:337)
    ==13777== by 0x80554B4: names_lh_free_LHASH_DOALL (o_names.c:341)
    ==13777== by 0x8062940: doall_util_fn (lhash.c:289)
    ==13777== by 0x806296E: lh_doall (lhash.c:297)
    ==13777==
    ==13777==
    ==13777== 292 bytes in 5 blocks are still reachable in loss record 2 of 2
    ==13777== at 0x40036F2: malloc (vg_replace_malloc.c:149)
    ==13777== by 0x80524FA: default_malloc_ex (mem.c:79)
    ==13777== by 0x8052A7C: CRYPTO_malloc (mem.c:304)
    ==13777== by 0x80624A7: lh_new (lhash.c:119)
    ==13777== by 0x80533C2: CRYPTO_dbg_malloc (mem_dbg.c:442)
    ==13777== by 0x8052AA3: CRYPTO_malloc (mem.c:309)
    ==13777== by 0x805511B: OBJ_NAME_add (o_names.c:191)
    ==13777== by 0x80668DC: EVP_add_cipher (names.c:69)
    ==13777== by 0x8049485: SSL_library_init (ssl_algs.c:68)
    ==13777== by 0x80493D5: main (in /data/openssl/testcase001)


    Stanislav Mikhailenko wrote:
    > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
    > SSLeay_add_ssl_algorithms();
    > SSL_load_error_strings();
    > ERR_remove_state(0);
    > ERR_free_strings();
    > EVP_cleanup();
    > CRYPTO_cleanup_all_ex_data();
    > ENGINE_cleanup();
    > CONF_modules_unload(1);
    >
    > This code makes leaks about hundred of bytes. It is only in this version
    > or older versions makes this too? or i did something wrong?
    >


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


  3. Re: Leaks in Initialization of library 0.9.8 i compiled with VC7.1 under Windows

    Stanislav Mikhailenko wrote:
    > CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
    > SSLeay_add_ssl_algorithms();
    > SSL_load_error_strings();
    > ERR_remove_state(0);
    > ERR_free_strings();
    > EVP_cleanup();
    > CRYPTO_cleanup_all_ex_data();
    > ENGINE_cleanup();
    > CONF_modules_unload(1);
    >
    > This code makes leaks about hundred of bytes. It is only in this version
    > or older versions makes this too? or i did something wrong?
    >



    How are you seeing these leaks ? Are you using CRYPTO_mem_xxxxx() for
    that ?


    With the same testcase on linux there are 6 leaked blocks.


    2 of them related to zlib and the lack of cleanup for the
    ssl/ssl_ciph.c:144 with the "ssl_comp_methods" variable holding a stack
    of "SSL_COMP *" then there is also the "SSL_COMP *" allocated for zlib.

    I have created a patch which can deal with the above leak.

    Do you have a ZLIB support enabled on Win32 ? Are you using a DLL for
    static version of ZLIB1.DLL ?


    4 of them relate to the CRYPTO_mem_xxxxx() leak checking functionality.
    the LHASH from crypto/mem_dbg.c:84 with the "mh" variable and also
    line 107 with the "amih" variable.

    If you remove the line: CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); on linux 4
    of the block are no longer leaked.


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


+ Reply to Thread