Red Hat Bugzilla – Bug 859717
memory leak with getaddrinfo()
Last modified: 2016-11-24 10:56:00 EST
Created attachment 616108 [details]
example code to recreate the memory leak
Description of problem:
getaddrinfo() leaks memory
Version-Release number of selected component (if applicable):
always using attached code
Steps to Reproduce:
1. cc leak.c -o leak
2. valgrind --leak-check=full --show-reachable=yes ./leak localhost
==11543== 240 bytes in 1 blocks are still reachable in loss record 1 of 1
==11543== at 0x4C2884D: malloc (vg_replace_malloc.c:263)
==11543== by 0x4F449FB: make_request (check_pf.c:250)
==11543== by 0x4F44C55: __check_pf (check_pf.c:343)
==11543== by 0x4F0BF08: getaddrinfo (getaddrinfo.c:2305)
==11543== by 0x400716: ip_from_string (in /home/noam/sources/getaddrinfo.bug/leak)
==11543== by 0x400822: main (in /home/noam/sources/getaddrinfo.bug/leak)
I also have Fedora15 machine which doesn't show this problem.
This does not appear in F15 because F15 doesn't cache information WRT what interfaces are available.
The memory leak is fixed in F18 & rawhide. It's a low priority issue as only a single object is leaked (rather than an object per call) and there aren't currently plans to backport the fix to F17.