Package: libconfuse-dev
Version: 2.7-4
Severity: normal

Hi,

cfg_free() does not completely clean the memory allocated by cfg_parse(). 
Below is a test with one of the example programs provided with the package 
(the valgrind -v output is attached).

Cheers,

  Matteo

$ gcc -Wall -Wextra -g -lconfuse  -o simple \
   /usr/share/doc/libconfuse-dev/examples/simple.c
$ cp /usr/share/doc/libconfuse-dev/examples/simple.conf .
$ valgrind --leak-check=full --show-reachable=yes ./simple
==19011== Memcheck, a memory error detector
==19011== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==19011== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==19011== Command: ./simple
==19011== 
verbose: true
server: gazonk
username: joe
debug: 17
delay: 1.356E-32
setting username to 'foo'
username: foo
==19011== 
==19011== HEAP SUMMARY:
==19011==     in use at exit: 8 bytes in 1 blocks
==19011==   total heap usage: 93 allocs, 92 frees, 27,591 bytes allocated
==19011== 
==19011== 8 bytes in 1 blocks are still reachable in loss record 1 of 1
==19011==    at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-
amd64-linux.so)
==19011==    by 0x4E3364F: ??? (in /usr/lib/x86_64-linux-
gnu/libconfuse.so.0.0.0)
==19011==    by 0x4E33768: cfg_yy_switch_to_buffer (in /usr/lib/x86_64-linux-
gnu/libconfuse.so.0.0.0)
==19011==    by 0x4E32861: cfg_parse_fp (in /usr/lib/x86_64-linux-
gnu/libconfuse.so.0.0.0)
==19011==    by 0x4E3292C: cfg_parse (in /usr/lib/x86_64-linux-
gnu/libconfuse.so.0.0.0)
==19011==    by 0x400A5C: main (simple.c:37)
==19011== 
==19011== LEAK SUMMARY:
==19011==    definitely lost: 0 bytes in 0 blocks
==19011==    indirectly lost: 0 bytes in 0 blocks
==19011==      possibly lost: 0 bytes in 0 blocks
==19011==    still reachable: 8 bytes in 1 blocks
==19011==         suppressed: 0 bytes in 0 blocks
==19011== 
==19011== For counts of detected and suppressed errors, rerun with: -v
==19011== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)

-- 
Ma clef GPG est disponible sur keyserver.veridis.com
My GPG key is available on keyserver.veridis.com
==19021== Memcheck, a memory error detector
==19021== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==19021== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==19021== Command: ./simple
==19021== 
--19021-- Valgrind options:
--19021--    --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp
--19021--    --leak-check=full
--19021--    --show-reachable=yes
--19021--    -v
--19021-- Contents of /proc/version:
--19021--   Linux version 3.0.0-1-amd64 (Debian 3.0.0-2) ([email protected]) 
(gcc version 4.5.3 (Debian 4.5.3-5) ) #1 SMP Wed Aug 17 04:08:52 UTC 2011
--19021-- Arch and hwcaps: AMD64, amd64-sse3-cx16
--19021-- Page sizes: currently 4096, max supported 4096
--19021-- Valgrind library directory: /usr/lib/valgrind
--19021-- Reading syms from /tmp/simple (0x400000)
--19021-- Reading syms from /lib/x86_64-linux-gnu/ld-2.13.so (0x4000000)
--19021--   Considering /lib/x86_64-linux-gnu/ld-2.13.so ..
--19021--   .. CRC mismatch (computed 4c0b00f5 wanted e1cc78bb)
--19021--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.13.so ..
--19021--   .. CRC is valid
--19021-- Reading syms from /usr/lib/valgrind/memcheck-amd64-linux (0x38000000)
--19021--    object doesn't have a symbol table
--19021--    object doesn't have a dynamic symbol table
--19021-- Reading suppressions file: /usr/lib/valgrind/debian-libc6-dbg.supp
--19021-- Reading suppressions file: /usr/lib/valgrind/default.supp
--19021-- REDIR: 0x40165e0 (strlen) redirected to 0x3805f727 (???)
--19021-- Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so 
(0x4a22000)
--19021--    object doesn't have a symbol table
--19021-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so 
(0x4c23000)
--19021--    object doesn't have a symbol table
==19021== WARNING: new redirection conflicts with existing -- ignoring it
--19021--     new: 0x040165e0 (strlen              ) R-> 0x04c280d0 strlen
--19021-- REDIR: 0x4016450 (index) redirected to 0x4c27d30 (index)
--19021-- REDIR: 0x40164d0 (strcmp) redirected to 0x4c28c90 (strcmp)
--19021-- Reading syms from /usr/lib/x86_64-linux-gnu/libconfuse.so.0.0.0 
(0x4e2d000)
--19021--    object doesn't have a symbol table
--19021-- Reading syms from /lib/x86_64-linux-gnu/libc-2.13.so (0x5039000)
--19021--   Considering /lib/x86_64-linux-gnu/libc-2.13.so ..
--19021--   .. CRC mismatch (computed 86840265 wanted 311d89e3)
--19021--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.13.so ..
--19021--   .. CRC is valid
--19021-- REDIR: 0x50bb3e0 (strncasecmp) redirected to 0x4a22620 
(_vgnU_ifunc_wrapper)
--19021-- REDIR: 0x50b9120 (strcasecmp) redirected to 0x4a22620 
(_vgnU_ifunc_wrapper)
--19021-- REDIR: 0x50b7180 (__GI_strrchr) redirected to 0x4c27b50 (__GI_strrchr)
--19021-- REDIR: 0x50b56a0 (__GI_strlen) redirected to 0x4c28090 (__GI_strlen)
--19021-- REDIR: 0x50b03b0 (malloc) redirected to 0x4c27730 (malloc)
--19021-- REDIR: 0x50af940 (calloc) redirected to 0x4c25dc0 (calloc)
--19021-- REDIR: 0x50bdab0 (memcpy) redirected to 0x4a22620 
(_vgnU_ifunc_wrapper)
--19021-- REDIR: 0x515b2b0 (__memcpy_ssse3_back) redirected to 0x4c28d90 
(memcpy)
--19021-- REDIR: 0x50b3c60 (__GI_strcmp) redirected to 0x4c28c30 (__GI_strcmp)
--19021-- REDIR: 0x50b58d0 (__GI_strncmp) redirected to 0x4c28590 (__GI_strncmp)
--19021-- REDIR: 0x50b3ba0 (__GI_strchr) redirected to 0x4c27c30 (__GI_strchr)
--19021-- REDIR: 0x50beed0 (strchrnul) redirected to 0x4c29dd0 (strchrnul)
--19021-- REDIR: 0x50b02d0 (free) redirected to 0x4c26890 (free)
--19021-- REDIR: 0x50b7880 (memchr) redirected to 0x4c28d50 (memchr)
--19021-- REDIR: 0x50b1400 (realloc) redirected to 0x4c27800 (realloc)
--19021-- REDIR: 0x51480d0 (__strcasecmp_sse42) redirected to 0x4c28610 
(strcasecmp)
--19021-- REDIR: 0x50b5780 (strnlen) redirected to 0x4c28010 (strnlen)
--19021-- REDIR: 0x50b8fd0 (__GI_stpcpy) redirected to 0x4c299d0 (__GI_stpcpy)
--19021-- REDIR: 0x50b50e0 (__GI_strcpy) redirected to 0x4c281c0 (__GI_strcpy)
--19021-- REDIR: 0x50bee80 (__GI___rawmemchr) redirected to 0x4c29e20 
(__GI___rawmemchr)
--19021-- REDIR: 0x50b3c20 (strcmp) redirected to 0x4a22620 
(_vgnU_ifunc_wrapper)
--19021-- REDIR: 0x5145850 (__strcmp_sse42) redirected to 0x4c28bd0 (strcmp)
verbose: true
server: gazonk
username: joe
debug: 17
delay: 1.356E-32
setting username to 'foo'
username: foo
==19021== 
==19021== HEAP SUMMARY:
==19021==     in use at exit: 8 bytes in 1 blocks
==19021==   total heap usage: 93 allocs, 92 frees, 27,591 bytes allocated
==19021== 
==19021== Searching for pointers to 1 not-freed blocks
==19021== Checked 77,168 bytes
==19021== 
==19021== 8 bytes in 1 blocks are still reachable in loss record 1 of 1
==19021==    at 0x4C2779D: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19021==    by 0x4E3364F: ??? (in 
/usr/lib/x86_64-linux-gnu/libconfuse.so.0.0.0)
==19021==    by 0x4E33768: cfg_yy_switch_to_buffer (in 
/usr/lib/x86_64-linux-gnu/libconfuse.so.0.0.0)
==19021==    by 0x4E32861: cfg_parse_fp (in 
/usr/lib/x86_64-linux-gnu/libconfuse.so.0.0.0)
==19021==    by 0x4E3292C: cfg_parse (in 
/usr/lib/x86_64-linux-gnu/libconfuse.so.0.0.0)
==19021==    by 0x400A5C: main (simple.c:37)
==19021== 
==19021== LEAK SUMMARY:
==19021==    definitely lost: 0 bytes in 0 blocks
==19021==    indirectly lost: 0 bytes in 0 blocks
==19021==      possibly lost: 0 bytes in 0 blocks
==19021==    still reachable: 8 bytes in 1 blocks
==19021==         suppressed: 0 bytes in 0 blocks
==19021== 
==19021== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)
--19021-- 
--19021-- used_suppression:      4 dl-hack3-cond-1
==19021== 
==19021== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to