public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug network/14984] getnameinfo() might be leaking memory
  2012-12-27 11:15 [Bug network/14984] New: getnameinfo() might be leaking memory emaentra at ngi dot it
@ 2012-12-27 11:15 ` emaentra at ngi dot it
  2012-12-31 10:38 ` emaentra at ngi dot it
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: emaentra at ngi dot it @ 2012-12-27 11:15 UTC (permalink / raw)
  To: glibc-bugs

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

E.O. <emaentra at ngi dot it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |emaentra at ngi dot it

-- 
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.


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

* [Bug network/14984] New: getnameinfo() might be leaking memory
@ 2012-12-27 11:15 emaentra at ngi dot it
  2012-12-27 11:15 ` [Bug network/14984] " emaentra at ngi dot it
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: emaentra at ngi dot it @ 2012-12-27 11:15 UTC (permalink / raw)
  To: glibc-bugs

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

             Bug #: 14984
           Summary: getnameinfo() might be leaking memory
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: network
        AssignedTo: unassigned@sourceware.org
        ReportedBy: emaentra@ngi.it
    Classification: Unclassified


Hi, as per summary, I'm running into some apparent memory leaks by
getnameinfo().
I'm using Ubuntu 12.04 (Linux scv 3.2.0-35-generic #55-Ubuntu SMP Wed Dec 5
17:42:16 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux) with gcc version 4.6.3.
glibc should be 2.15.

When I invoke getnameinfo(), valgrind reports a memory leak:
==4425== 
==4425== HEAP SUMMARY:
==4425==     in use at exit: 10 bytes in 1 blocks
==4425==   total heap usage: 4,508 allocs, 4,507 frees, 134,939,153 bytes
allocated
==4425== 
==4425== 10 bytes in 1 blocks are definitely lost in loss record 1 of 1
==4425==    at 0x4C2B6CD: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4425==    by 0x50D7D71: strdup (strdup.c:43)
==4425==    by 0x1484B861: ???
==4425==    by 0x515B871: gethostbyaddr_r@@GLIBC_2.2.5 (getXXbyYY_r.c:256)
==4425==    by 0x5161D06: getnameinfo (getnameinfo.c:223)
==4425==    by 0x404175: solsrv_run (solsrv.c:381)
==4425==    by 0x404DAC: main (main.c:167)
==4425== 
==4425== LEAK SUMMARY:
==4425==    definitely lost: 10 bytes in 1 blocks
==4425==    indirectly lost: 0 bytes in 0 blocks
==4425==      possibly lost: 0 bytes in 0 blocks
==4425==    still reachable: 0 bytes in 0 blocks
==4425==         suppressed: 0 bytes in 0 blocks
==4425== 
==4425== For counts of detected and suppressed errors, rerun with: -v
==4425== ERROR SUMMARY: 12 errors from 11 contexts (suppressed: 2 from 2)

As you can see looks like valgrind is using an old version of GLIBC.
Could you please confirm if this is a valgrind issue or a genuine glibc memory
leak on getnameinfo()?
Code generating the apparent leak is:

struct sockaddr addr;
socklen_t           addr_sz = sizeof(addr);
char        host[NI_MAXHOST],
            serv[NI_MAXSERV];
int infd = accept(srv_fd, (struct sockaddr*)&addr, &addr_sz);
if (infd == -1) {
    ... manage error on accept ...
}
if(getnameinfo((struct sockaddr *)&addr, addr_sz, host, NI_MAXHOST, serv,
NI_MAXSERV, NI_NUMERICSERV)) {
    strncpy(host, "<unknown host>", NI_MAXHOST-1);
    strncpy(serv, "<unknown port>", NI_MAXSERV-1);
}

The more I execute getnameinfo() (i.e. for each client which connects to the
server), the more memory is apparently leaked.

Thanks

-- 
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.


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

* [Bug network/14984] getnameinfo() might be leaking memory
  2012-12-27 11:15 [Bug network/14984] New: getnameinfo() might be leaking memory emaentra at ngi dot it
  2012-12-27 11:15 ` [Bug network/14984] " emaentra at ngi dot it
@ 2012-12-31 10:38 ` emaentra at ngi dot it
  2013-01-07 11:02 ` schwab@linux-m68k.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: emaentra at ngi dot it @ 2012-12-31 10:38 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #1 from E.O. <emaentra at ngi dot it> 2012-12-31 10:37:45 UTC ---
Apparently when connecting to the server socket specifying the name
"<hostname>.local" the function does leak.

-- 
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.


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

* [Bug network/14984] getnameinfo() might be leaking memory
  2012-12-27 11:15 [Bug network/14984] New: getnameinfo() might be leaking memory emaentra at ngi dot it
  2012-12-27 11:15 ` [Bug network/14984] " emaentra at ngi dot it
  2012-12-31 10:38 ` emaentra at ngi dot it
@ 2013-01-07 11:02 ` schwab@linux-m68k.org
  2013-01-20  0:35 ` emaentra at ngi dot it
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: schwab@linux-m68k.org @ 2013-01-07 11:02 UTC (permalink / raw)
  To: glibc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> 2013-01-07 11:01:42 UTC ---
If .local is triggering the leak then the bug is likely in the avahi nss
modules.  Please find out who is calling strdup.

-- 
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.


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

* [Bug network/14984] getnameinfo() might be leaking memory
  2012-12-27 11:15 [Bug network/14984] New: getnameinfo() might be leaking memory emaentra at ngi dot it
                   ` (2 preceding siblings ...)
  2013-01-07 11:02 ` schwab@linux-m68k.org
@ 2013-01-20  0:35 ` emaentra at ngi dot it
  2013-10-08 18:33 ` neleai at seznam dot cz
  2014-06-14  5:29 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: emaentra at ngi dot it @ 2013-01-20  0:35 UTC (permalink / raw)
  To: glibc-bugs

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

E.O. <emaentra at ngi dot it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #3 from E.O. <emaentra at ngi dot it> 2013-01-20 00:35:11 UTC ---
Thanks. Should we be closing this bug?

-- 
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.


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

* [Bug network/14984] getnameinfo() might be leaking memory
  2012-12-27 11:15 [Bug network/14984] New: getnameinfo() might be leaking memory emaentra at ngi dot it
                   ` (3 preceding siblings ...)
  2013-01-20  0:35 ` emaentra at ngi dot it
@ 2013-10-08 18:33 ` neleai at seznam dot cz
  2014-06-14  5:29 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: neleai at seznam dot cz @ 2013-10-08 18:33 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14984

Ondrej Bilka <neleai at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |neleai at seznam dot cz
         Resolution|---                         |WORKSFORME

--- Comment #4 from Ondrej Bilka <neleai at seznam dot cz> ---
Closing as this is probably avahi nss issue as Andreas pointed out.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug network/14984] getnameinfo() might be leaking memory
  2012-12-27 11:15 [Bug network/14984] New: getnameinfo() might be leaking memory emaentra at ngi dot it
                   ` (4 preceding siblings ...)
  2013-10-08 18:33 ` neleai at seznam dot cz
@ 2014-06-14  5:29 ` fweimer at redhat dot com
  5 siblings, 0 replies; 7+ messages in thread
From: fweimer at redhat dot com @ 2014-06-14  5:29 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14984

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2014-06-14  5:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-27 11:15 [Bug network/14984] New: getnameinfo() might be leaking memory emaentra at ngi dot it
2012-12-27 11:15 ` [Bug network/14984] " emaentra at ngi dot it
2012-12-31 10:38 ` emaentra at ngi dot it
2013-01-07 11:02 ` schwab@linux-m68k.org
2013-01-20  0:35 ` emaentra at ngi dot it
2013-10-08 18:33 ` neleai at seznam dot cz
2014-06-14  5:29 ` fweimer 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).