Package: libc6-bin
Version: 2.11.3-3
Severity:important


Using the function getpwuid() in my application, resulted in a memory leak. The 
minimal test case is this:
$ cat  c.c
#include<pwd.h>
main() {
        struct passwd *q = getpwuid(geteuid());
}

$ gcc c.c&&  valgrind --leak-check=full ./a.out
==22230== Memcheck, a memory error detector
==22230== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==22230== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for 
copyright info
==22230== Command: ./a.out
==22230==
==22230==
==22230== HEAP SUMMARY:
==22230==     in use at exit: 300 bytes in 11 blocks
==22230==   total heap usage: 68 allocs, 57 frees, 9,898 bytes allocated
==22230==
==22230== 300 (60 direct, 240 indirect) bytes in 1 blocks are definitely lost 
in loss record 11 of 11
==22230==    at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==22230==    by 0x4F08A3C: nss_parse_service_list (nsswitch.c:622)
==22230==    by 0x4F0922D: __nss_database_lookup (nsswitch.c:164)
==22230==    by 0x558D34F: ???
==22230==    by 0x558DFA4: ???
==22230==    by 0x4EC8D8C: getpwuid_r@@GLIBC_2.2.5 (getXXbyYY_r.c:253)
==22230==    by 0x4EC867E: getpwuid (getXXbyYY.c:117)
==22230==    by 0x40054C: main (in /tmp/a.out)
==22230==
==22230== LEAK SUMMARY:
==22230==    definitely lost: 60 bytes in 1 blocks
==22230==    indirectly lost: 240 bytes in 10 blocks
==22230==      possibly lost: 0 bytes in 0 blocks
==22230==    still reachable: 0 bytes in 0 blocks
==22230==         suppressed: 0 bytes in 0 blocks
==22230==
==22230== For counts of detected and suppressed errors, rerun with: -v
==22230== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)


The bug is described here:
http://sourceware.org/bugzilla/show_bug.cgi?id=14122

The fix is here:
http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=d44638b0a7fc1f01c3b2153cfa1bbb849f01f217


Since this is fixed only in glibc v2.16, and debian squeeze is using 2.11 and 
wheezy uses 2.13 it would be great if this could be fixed also Debian stable 
and testing.


Alois




Reply via email to