Bug 187087 - memory leak in glibc
memory leak in glibc
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks: 181409
  Show dependency treegraph
 
Reported: 2006-03-28 08:09 EST by manuel wolfshant
Modified: 2007-11-30 17:07 EST (History)
1 user (show)

See Also:
Fixed In Version: RHBA-2006-0510
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-08-10 17:35:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description manuel wolfshant 2006-03-28 08:09:33 EST
Description of problem:
A friend of mine discovered that freeaddrinfo does not release all the memory
that was previously alocated

Version-Release number of selected component (if applicable):
any glibc (tested in RHEL 4U3 - glibc 2.3.6 and gentoo - glibc 2.4)

How reproducible:
Always
Steps to Reproduce:
1. compile the following program:
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>

int main()
{
  struct sockaddr addr;

  struct addrinfo hints, *ai_res;
  struct protoent *pe;

  memset(&hints, 0, sizeof(hints));

  hints.ai_socktype = SOCK_STREAM;
  hints.ai_protocol = IPPROTO_TCP;
  hints.ai_flags = AI_CANONNAME;
  hints.ai_family = PF_UNSPEC;

  ::getaddrinfo("127.0.0.1", "smtp", &hints, &ai_res);
  ::freeaddrinfo(ai_res);

  return 0;
}

2. g++ test.c -o test
3. run valgrind   --tool=memcheck -v --leak-check=yes ./test

Actual results:

==9371== 10 bytes in 1 blocks are definitely lost in loss record 1 of 1
==9371==    at 0x1B903984: malloc (vg_replace_malloc.c:131)
==9371==    by 0x2FCB9F: strdup (in /lib/tls/libc-2.3.6.so)
==9371==    by 0x342C9D: gaih_inet (in /lib/tls/libc-2.3.6.so)
==9371==    by 0x344690: getaddrinfo (in /lib/tls/libc-2.3.6.so)
==9371==
==9371== LEAK SUMMARY:
==9371==    definitely lost: 10 bytes in 1 blocks.
==9371==    possibly lost:   0 bytes in 0 blocks.
==9371==    still reachable: 0 bytes in 0 blocks.
==9371==         suppressed: 0 bytes in 0 blocks.

Expected results:

No "lost" bytes
Additional info: http://pastebin.com/626735
Comment 6 Bob Johnson 2006-04-11 12:46:58 EDT
This issue is on Red Hat Engineering's list of planned work items 
for the upcoming Red Hat Enterprise Linux 4.4 release.  Engineering 
resources have been assigned and barring unforeseen circumstances, Red 
Hat intends to include this item in the 4.4 release.
Comment 11 Red Hat Bugzilla 2006-08-10 17:35:19 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0510.html

Note You need to log in before you can comment on or make changes to this bug.