[Help-gnutls] memory leak when using gnutls_handshake

Martin Knappe martin.knappe at gmail.com
Tue Jan 13 11:10:53 CET 2009


hi

at out company we're using gnutls gnutls 1.4.4

while debugging our gnutls program with valgrind, a memory leak seems to
occur when using gnutls_handshake.

the calling sequence is:

gnutls_global_init();
gnutls_init(&session, GNUTLS_SERVER);
gnutls_set_default_priority(session);
gnutls_kx_set_priority(session, (const int[]) {GNUTLS_KX_DHE_PSK, 0});
gnutls_credentials_set(*session, GNUTLS_CRD_PSK, psk_cred);
fd = getFD;
gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t) fd);
gnutls_handshake(session);

here using session...

gnutls_bye(session, GNUTLS_SHUT_RDWR);
gnutls_deinit(session);
gnutls_global_deinit();

valgrind says there are memory leaks because of the handshake function:

==10134== 418 (160 direct, 258 indirect) bytes in 1 blocks are definitely
lost in loss record 9 of 15
==10134==    at 0x401C6CA: calloc (vg_replace_malloc.c:279)
==10134==    by 0x42B98E5: _gnutls_auth_info_set (in
/usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x42D5421: (within /usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x42B4A18: _gnutls_send_server_kx_message (in
/usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x42B17EB: _gnutls_handshake_server (in
/usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x42B1DD5: gnutls_handshake (in
/usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x804A8DD: acceptNewSession (ultmanager.c:351)
==10134==    by 0x804B012: main (ultmanager.c:590)
==10134==
==10134==
==10134== 258 bytes in 3 blocks are indirectly lost in loss record 10 of 15
==10134==    at 0x401D38B: malloc (vg_replace_malloc.c:149)
==10134==    by 0x42BCED1: _gnutls_mpi_dprint_lz (in
/usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x42C9135: _gnutls_dh_set_group (in
/usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x42D543B: (within /usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x42B4A18: _gnutls_send_server_kx_message (in
/usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x42B17EB: _gnutls_handshake_server (in
/usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x42B1DD5: gnutls_handshake (in
/usr/lib/libgnutls.so.13.0.9)
==10134==    by 0x804A8DD: acceptNewSession (ultmanager.c:351)
==10134==    by 0x804B012: main (ultmanager.c:590)

is there anything i am forgetting to do when closing the connection? or is
this a bug in version 1.4.4??

many thanks

martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20090113/f5172d4d/attachment.htm>


More information about the Gnutls-help mailing list