1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00
2004-07-21  Jakub Jelinek  <jakub@redhat.com>

	* resolv/res_libc.c (res_init): If RES_INIT is set and
	_res.nscount > 0, call __res_nclose and free nsaddrs.
	* resolv/Makefile: Add rules to build and run tst-leaks2.
	* resolv/tst-leaks2.c: New test.
This commit is contained in:
Ulrich Drepper
2004-07-21 18:30:11 +00:00
parent 84b5ba7ecf
commit 2ed2dc1846
4 changed files with 69 additions and 2 deletions

View File

@ -54,6 +54,14 @@ res_init(void) {
_res.retry = 4;
if (!(_res.options & RES_INIT))
_res.options = RES_DEFAULT;
else if (_res.nscount > 0) {
__res_nclose (&_res); /* Close any VC sockets. */
for (int ns = 0; ns < MAXNS; ns++) {
free (_res._u._ext.nsaddrs[ns]);
_res._u._ext.nsaddrs[ns] = NULL;
}
}
/*
* This one used to initialize implicitly to zero, so unless the app