[gnutls-dev] leak using gcrypt

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Wed Feb 9 16:29:39 CET 2005


Using gcrypt gnutls leak some memory (about 2 Kbi).
Following a small program that leak memory

#include <gnutls/gnutls.h>

int main()
{
        gnutls_global_init();
        gnutls_global_deinit();
        return 0;
}

gnutls_global_init calls gc_init to initialize gcrypt however
gnutls_global_deinit does not call a gc_deinit (which doesn't even
exist).
Leak appear in the call of gcry_check_version. From Valgrind log:

==18594==
==18594== 2000 bytes in 30 blocks are still reachable in loss record 1
of 1
==18594==    at 0x1B903D48: malloc (vg_replace_malloc.c:131)
==18594==    by 0x4F65381A: (within /usr/lib/libgcrypt.so.11.1.1)
==18594==    by 0x4F650DC2: (within /usr/lib/libgcrypt.so.11.1.1)
==18594==    by 0x4F650DF7: gcry_malloc (in
/usr/lib/libgcrypt.so.11.1.1)
==18594==    by 0x4F6545C7: (within /usr/lib/libgcrypt.so.11.1.1)
==18594==    by 0x4F654EA8: (within /usr/lib/libgcrypt.so.11.1.1)
==18594==    by 0x4F656BA6: (within /usr/lib/libgcrypt.so.11.1.1)
==18594==    by 0x4F65080F: (within /usr/lib/libgcrypt.so.11.1.1)
==18594==    by 0x4F650932: gcry_check_version (in
/usr/lib/libgcrypt.so.11.1.1)
==18594==    by 0x46AA7D8E: (within /usr/lib/libgnutls.so.12.1.25)
==18594==    by 0x46A973D3: gnutls_global_init (in
/usr/lib/libgnutls.so.12.1.25)
==18594==    by 0x8048500: main (in /home/freddy/cpp/leak)
==18594==
==18594== LEAK SUMMARY:
==18594==    definitely lost: 0 bytes in 0 blocks.
==18594==    possibly lost:   0 bytes in 0 blocks.
==18594==    still reachable: 2000 bytes in 30 blocks.
==18594==         suppressed: 0 bytes in 0 blocks.

freddy77



More information about the Gnutls-dev mailing list