[sr #107524] Test suite: gnutls_global_init/gnutls_global_deinit

Jeffrey Walton INVALID.NOREPLY at gnu.org
Thu Nov 18 12:57:52 CET 2010


Follow-up Comment #1, sr #107524 (project gnutls):

My bad.... this might actually be an issue.

For example, certificate_set_x509_crl calls both gnutls_global_init and
gnutls_global_deinit. Since cleanup is being performed, there should probably
be nothing reported in Valgrind under "still reachable". See below.

Valgrind also claims openpgpself, gnutls_handshake,  is definitely leaking.

Attached is a jagged test script (enhancements welcomed) and test results.
For completeness:

$ ./configure CFLAGS=:"-DDEBUG -g3 -ggdb -O0"
$ make && make check
$ cd tests
$ ./valgrind-gnutls.sh      # output to valgrind-gnutls.txt
$ cat valgrind-gnutls.txt | egrep -c 'definitely lost: [1-9]'
20


**==**==**==**==**==**==**==**==**==**==**==**==**==**==

==20055== Memcheck, a memory error detector
==20055== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==20055== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for
copyright info
==20055== Command: ./certificate_set_x509_crl
==20055== 
==20055== 
==20055== HEAP SUMMARY:
==20055==     in use at exit: 3,056 bytes in 38 blocks
==20055==   total heap usage: 3,416 allocs, 3,378 frees, 133,604 bytes
allocated
==20055== 
==20055== 240 bytes in 5 blocks are still reachable in loss record 1 of 5
==20055==    at 0x4C274A8: malloc (vg_replace_malloc.c:236)
==20055==    by 0x553D7F0: do_malloc (global.c:737)
==20055==    by 0x553D9F8: _gcry_malloc (global.c:759)
==20055==    by 0x55425F0: _gcry_module_add (module.c:88)
==20055==    by 0x5546D0F: pk_register_default (pubkey.c:216)
==20055==    by 0x554716E: _gcry_pk_init (pubkey.c:2598)
==20055==    by 0x553DCB4: global_init (global.c:105)
==20055==    by 0x553DEF5: _gcry_check_version (global.c:222)
==20055==    by 0x4E66662: gnutls_global_init (gnutls_global.c:191)
==20055==    by 0x400B26: main (certificate_set_x509_crl.c:59)
==20055== 
==20055== 624 bytes in 13 blocks are still reachable in loss record 2 of 5
==20055==    at 0x4C274A8: malloc (vg_replace_malloc.c:236)
==20055==    by 0x553D7F0: do_malloc (global.c:737)
==20055==    by 0x553D9F8: _gcry_malloc (global.c:759)
==20055==    by 0x55425F0: _gcry_module_add (module.c:88)
==20055==    by 0x554F5D3: md_register_default (md.c:188)
==20055==    by 0x554F7BE: _gcry_md_init (md.c:1291)
==20055==    by 0x553DCA8: global_init (global.c:102)
==20055==    by 0x553DEF5: _gcry_check_version (global.c:222)
==20055==    by 0x4E66662: gnutls_global_init (gnutls_global.c:191)
==20055==    by 0x400B26: main (certificate_set_x509_crl.c:59)
==20055== 
==20055== 664 bytes in 1 blocks are still reachable in loss record 3 of 5
==20055==    at 0x4C274A8: malloc (vg_replace_malloc.c:236)
==20055==    by 0x553D7F0: do_malloc (global.c:737)
==20055==    by 0x553D9F8: _gcry_malloc (global.c:759)
==20055==    by 0x553DA4E: _gcry_xmalloc (global.c:903)
==20055==    by 0x553DA9E: _gcry_xcalloc (global.c:965)
==20055==    by 0x557A82E: initialize (random-csprng.c:335)
==20055==    by 0x557A8D4: _gcry_rngcsprng_create_nonce
(random-csprng.c:1330)
==20055==    by 0x4E7FB1C: wrap_gcry_rnd_init (rnd-libgcrypt.c:39)
==20055==    by 0x4E7CF09: _gnutls_rnd_init (random.c:39)
==20055==    by 0x4E6685A: gnutls_global_init (gnutls_global.c:237)
==20055==    by 0x400B26: main (certificate_set_x509_crl.c:59)
==20055== 
==20055== 664 bytes in 1 blocks are still reachable in loss record 4 of 5
==20055==    at 0x4C274A8: malloc (vg_replace_malloc.c:236)
==20055==    by 0x553D7F0: do_malloc (global.c:737)
==20055==    by 0x553D9F8: _gcry_malloc (global.c:759)
==20055==    by 0x553DA4E: _gcry_xmalloc (global.c:903)
==20055==    by 0x553DA9E: _gcry_xcalloc (global.c:965)
==20055==    by 0x557A852: initialize (random-csprng.c:338)
==20055==    by 0x557A8D4: _gcry_rngcsprng_create_nonce
(random-csprng.c:1330)
==20055==    by 0x4E7FB1C: wrap_gcry_rnd_init (rnd-libgcrypt.c:39)
==20055==    by 0x4E7CF09: _gnutls_rnd_init (random.c:39)
==20055==    by 0x4E6685A: gnutls_global_init (gnutls_global.c:237)
==20055==    by 0x400B26: main (certificate_set_x509_crl.c:59)
==20055== 
==20055== 864 bytes in 18 blocks are still reachable in loss record 5 of 5
==20055==    at 0x4C274A8: malloc (vg_replace_malloc.c:236)
==20055==    by 0x553D7F0: do_malloc (global.c:737)
==20055==    by 0x553D9F8: _gcry_malloc (global.c:759)
==20055==    by 0x55425F0: _gcry_module_add (module.c:88)
==20055==    by 0x55446B1: cipher_register_default (cipher.c:301)
==20055==    by 0x55448EE: _gcry_cipher_init (cipher.c:1873)
==20055==    by 0x553DC9F: global_init (global.c:99)
==20055==    by 0x553DEF5: _gcry_check_version (global.c:222)
==20055==    by 0x4E66662: gnutls_global_init (gnutls_global.c:191)
==20055==    by 0x400B26: main (certificate_set_x509_crl.c:59)
==20055== 
==20055== LEAK SUMMARY:
==20055==    definitely lost: 0 bytes in 0 blocks
==20055==    indirectly lost: 0 bytes in 0 blocks
==20055==      possibly lost: 0 bytes in 0 blocks
==20055==    still reachable: 3,056 bytes in 38 blocks
==20055==         suppressed: 0 bytes in 0 blocks
==20055== 
==20055== For counts of detected and suppressed errors, rerun with: -v
==20055== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)

(file #22046, file #22047)
    _______________________________________________________

Additional Item Attachment:

File name: valgrind-gnutls.sh             Size:0 KB
File name: valgrind-gnutls.txt.tar.gz     Size:18 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/support/?107524>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





More information about the Gnutls-devel mailing list