Description of problem:
According to valgrind, getaddrinfo() is leaking memory.
freeaddrinfo() does not release everything that was allocate by
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Compile the following program: cc -g -o leakcheck leakcheck.c
struct addrinfo hints, *res;
for (i=0; i<100; i++)
memset(&hints, 0, sizeof(hints));
errcode=getaddrinfo("www.cnn.com", "http", &hints, &res);
2. valgrind --num-callers=12 --leak-check=yes ./leakcheck
==12713== Memcheck, a.k.a. Valgrind, a memory error detector for
==12713== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==12713== Using valgrind-2.0.0, a program supervision framework for
==12713== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==12713== Estimated CPU clock rate is 1137 MHz
==12713== For more details, rerun with: -v
==12713== discard syms in /lib/libnss_files-2.3.2.so due to munmap()
==12713== discard syms in /lib/libnss_dns-2.3.2.so due to munmap()
==12713== discard syms in /lib/libresolv-2.3.2.so due to munmap()
==12713== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 1)
==12713== malloc/free: in use at exit: 2772 bytes in 99 blocks.
==12713== malloc/free: 1360 allocs, 1261 frees, 190793 bytes allocated.
==12713== For counts of detected errors, rerun with: -v
==12713== searching for pointers to 99 not-freed blocks.
==12713== checked 4590680 bytes.
==12713== 2772 bytes in 99 blocks are definitely lost in loss record 1
==12713== at 0x9ED68E: malloc (vg_replace_malloc.c:153)
==12713== by 0xD5BE9B: ???
==12713== by 0xD5AC12: ???
==12713== by 0xD5B309: ???
==12713== by 0xD5AF0F: ???
==12713== by 0x64805D: ???
==12713== by 0xF86D25: gaih_inet (in /lib/libc-2.3.2.so)
==12713== by 0xF87923: __GI_getaddrinfo (in /lib/libc-2.3.2.so)
==12713== by 0x80484D1: main (leakcheck.c:15)
==12713== by 0xED5BBE: __libc_start_main (in /lib/libc-2.3.2.so)
==12713== by 0x80483E8: (within /var/tmp/leakcheck)
==12713== LEAK SUMMARY:
==12713== definitely lost: 2772 bytes in 99 blocks.
==12713== possibly lost: 0 bytes in 0 blocks.
==12713== still reachable: 0 bytes in 0 blocks.
==12713== suppressed: 0 bytes in 0 blocks.
==12713== Reachable blocks (those to which a pointer was found) are
==12713== To see them, rerun with: --show-reachable=yes
Ok, fixed in my copy. Would you like to be listed in the testcase
as its author and if so, is the above email address the one you want to use?
List my address as firstname.lastname@example.org
An errata 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.
This problem still occurs in FC3. See also bug 139559.
No, the problem doesn't occur on FC3. There is completely unrelated problem
newly introduced in FC3, see #139559.