public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zhenhua2000 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug nscd/11501] New: Memory leak when invoking openpty
Date: Thu, 15 Apr 2010 10:14:00 -0000	[thread overview]
Message-ID: <20100415101432.11501.zhenhua2000@gmail.com> (raw)

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.


             reply	other threads:[~2010-04-15 10:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 10:14 zhenhua2000 at gmail dot com [this message]
2010-04-15 20:01 ` [Bug nscd/11501] " drepper at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100415101432.11501.zhenhua2000@gmail.com \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).