Bug 187087 - memory leak in glibc
Summary: memory leak in glibc
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc
Version: 4.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks: 181409
TreeView+ depends on / blocked
 
Reported: 2006-03-28 13:09 UTC by manuel wolfshant
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version: RHBA-2006-0510
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-08-10 21:35:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2006:0510 0 normal SHIPPED_LIVE glibc bug fix update 2006-08-09 04:00:00 UTC

Description manuel wolfshant 2006-03-28 13:09:33 UTC
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 16:46:58 UTC
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 21:35:19 UTC
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.