This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/14122] memory leak in nss_parse_service_list()


http://sourceware.org/bugzilla/show_bug.cgi?id=14122

--- Comment #9 from Paul Pluzhnikov <ppluzhnikov at google dot com> 2012-05-21 01:13:11 UTC ---
I sent a patch to handle leaks on error paths:
http://sourceware.org/ml/libc-alpha/2012-05/msg01433.html

However, with the patch applied, using Alois's copy of nsswitch.conf, or just
completely empty nsswitch.conf, I still see the leak.

It's kind of a false positive, and I am not sure we can reasonably do anything
about it.

The problem is this code in nss/getXXbyYY_r.c:

   152    static service_user *startp;
...
   230            tmp_ptr = nip;
   231            PTR_MANGLE (tmp_ptr);
   232            startp = tmp_ptr;

That is, the returned (allocated) value is in "nip" variable, and it gets saved
into startp (static), so it is not a leak.

But it is saved in mangled form, which makes that invisible to Valgrind.

Perhaps we should free PTR_DEMANGLE(startp) on __libc_freeres ?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]