This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

res_nsearch leak?


Hello,

I'm trying to track down a leak in res_nsearch as demonstrated by the
following program:

#include <stdlib.h>
#include <resolv.h>

int
main(void)
{
	unsigned char buf[1024];
	struct __res_state state;
	int len;

	memset(&state, 0, sizeof(state));
	res_ninit(&state);
	len = res_nsearch(&state, "www.foo.net", 1, 1, buf, sizeof(buf));
	res_nclose(&state);

	return EXIT_SUCCESS;
}

==8684== 28 bytes in 1 blocks are definitely lost in loss record 1 of 1
==8684==    at 0x1B905A90: malloc (vg_replace_malloc.c:131)
==8684==    by 0xA3E107: __libc_res_nsend (in /lib/libresolv-2.3.6.so)
==8684==    by 0xA3D0F2: __GI___libc_res_nquery (in /lib/libresolv-2.3.6.so)
==8684==    by 0xA3D3B7: __libc_res_nquerydomain (in /lib/libresolv-2.3.6.so)
==8684==    by 0xA3D91D: __GI___libc_res_nsearch (in /lib/libresolv-2.3.6.so)
==8684==    by 0xA3DA99: __GI___res_nsearch (in /lib/libresolv-2.3.6.so)
==8684==    by 0x80485E9: main (in /home/miallen/p/c/nsearch)
==8684== 
==8684== LEAK SUMMARY:
==8684==    definitely lost: 28 bytes in 1 blocks.

I've checked 2.5 see no change in the resolve code. I've checked the
latest bind and see res_ndestroy is interesting but glibc doesn't seem
to have it. Can someone tell me where I went wrong?

Mike


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]