4661fda2e5
This patch fixes a leak that occurs when creating a new thread-specific DNS resolver state object. Essentially, each thread that calls gethostbyname() or getaddrinfo() at least once will leak a small memory block. Another leak happens anytime these functions are called after a change of the network settings. The leak is insignificant and hard to notice on typical programs. However, netd tends to create one new thread for each DNS request it processes, and quickly grows in size after a > 20 hours. The same problem is seen in other system processes that tend to create one thread per request too. The leak occured becasue res_ninit() was called twice when creating a new thread-specific DNS resolver state in _res_get_thread(). This function could not properly reset an existing thread and was leaking a memory block. The patch does two things: - First, it fixes res_ninit() to prevent any leakage when resetting the state of a given res_state instance. - Second, it modifies the _res_get_thread() implementation to make it more explicit, and avoid calling res_ninit() twice in a row on first-time creation. Fix for Bug 4089945, and Bug 4090857 Change-Id: Ie4831a8dbe82be8f07fce5ddd1d36bf95994f836 |
||
---|---|---|
.. | ||
inet | ||
isc | ||
nameser | ||
net | ||
resolv | ||
gethnamaddr.c |