public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nscd/11501] New: Memory leak when invoking openpty
@ 2010-04-15 10:14 zhenhua2000 at gmail dot com
  2010-04-15 20:01 ` [Bug nscd/11501] " drepper at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: zhenhua2000 at gmail dot com @ 2010-04-15 10:14 UTC (permalink / raw)
  To: glibc-bugs

Valgrind reports definitely lost memory leak when I am invoking 
openpty(). This function is defined in /usr/lib/libutil.a belonging libc6-dev. I 
also download source eglibc-2.10.1, but it doesn't help to fix my problem.


My program is:
#include <unistd.h>
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <utmp.h>
#include <pty.h>

int main(int argc, char **argv)
{
         int master, slave;

         if (openpty(&master, &slave, NULL, NULL, NULL) < 0)
               return -1;

         close(master);
         close(slave);

         return 0;
}

$ valgrind --leak-check=full ./test
==25001== Memcheck, a memory error detector
==25001== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==25001== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==25001== Command: ./test
==25001==
==25001==
==25001== HEAP SUMMARY:
==25001==     in use at exit: 160 bytes in 11 blocks
==25001==   total heap usage: 67 allocs, 56 frees, 5,594 bytes allocated
==25001==
==25001== 160 (40 direct, 120 indirect) bytes in 1 blocks are definitely 
lost in loss record 11 of 11
==25001==    at 0x4024C6C: malloc (vg_replace_malloc.c:195)
==25001==    by 0x41D8323: nss_parse_service_list (nsswitch.c:622)
==25001==    by 0x41D8A68: __nss_database_lookup (nsswitch.c:164)
==25001==    by 0x4672F2B: ???
==25001==    by 0x4673A24: ???
==25001==    by 0x418F954: getgrnam_r@@GLIBC_2.1.2 (getXXbyYY_r.c:253)
==25001==    by 0x41FB2FE: __unix_grantpt (grantpt.c:138)
==25001==    by 0x41FB588: grantpt (grantpt.c:84)
==25001==    by 0x40F7021: openpty (openpty.c:102)
==25001==    by 0x804A0E4: main (test-server2.c:40)
==25001==
==25001== LEAK SUMMARY:
==25001==    definitely lost: 40 bytes in 1 blocks
==25001==    indirectly lost: 120 bytes in 10 blocks
==25001==      possibly lost: 0 bytes in 0 blocks
==25001==    still reachable: 0 bytes in 0 blocks
==25001==         suppressed: 0 bytes in 0 blocks
==25001==
==25001== For counts of detected and suppressed errors, rerun with: -v
==25001== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 25 from 8)

-- 
           Summary: Memory leak when invoking openpty
           Product: glibc
           Version: 2.10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nscd
        AssignedTo: drepper at redhat dot com
        ReportedBy: zhenhua2000 at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: X86
  GCC host triplet: X86
GCC target triplet: X86


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug nscd/11501] Memory leak when invoking openpty
  2010-04-15 10:14 [Bug nscd/11501] New: Memory leak when invoking openpty zhenhua2000 at gmail dot com
@ 2010-04-15 20:01 ` drepper at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: drepper at redhat dot com @ 2010-04-15 20:01 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2010-04-15 20:00 -------
I don't see any problem like this.  You're not using the upstream glibc so who
knows what changes you're using.

The list created is freed the freeres functions.  valgrind calls these
descriptors.  I not it's a problem somewhere on your system.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-15 20:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-15 10:14 [Bug nscd/11501] New: Memory leak when invoking openpty zhenhua2000 at gmail dot com
2010-04-15 20:01 ` [Bug nscd/11501] " drepper at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).