resolved conflicts for merge of 9363d912 to honeycomb-plus-aosp
Change-Id: Ib0680d7e0be34ae656a9675ddd1014a6193a4006
diff --git a/libc/netbsd/resolv/res_cache.c b/libc/netbsd/resolv/res_cache.c
index efce7dc..e3ceb5a 100644
--- a/libc/netbsd/resolv/res_cache.c
+++ b/libc/netbsd/resolv/res_cache.c
@@ -1627,6 +1627,7 @@
while (cache_info) {
if (cache_info->ifname[0] != '\0') {
ifname = cache_info->ifname;
+ break;
}
cache_info = cache_info->next;
@@ -1684,6 +1685,7 @@
while (cache_info) {
if (cache_info->ifname[0] != '\0') {
ifname = cache_info->ifname;
+ break;
}
cache_info = cache_info->next;
@@ -1691,18 +1693,15 @@
}
struct resolv_cache* cache = _get_res_cache_for_iface_locked(ifname);
- if (cache == NULL) {
- pthread_mutex_unlock(&_res_cache_list_lock);
- return;
+ if (cache != NULL) {
+ pthread_mutex_lock( &cache->lock );
+ if (cache->generation != generation) {
+ _cache_flush_locked(cache);
+ cache->generation = generation;
+ }
+ pthread_mutex_unlock( &cache->lock );
}
- pthread_mutex_lock( &cache->lock );
- if (cache->generation != generation) {
- _cache_flush_locked(cache);
- cache->generation = generation;
- }
- pthread_mutex_unlock( &cache->lock );
-
pthread_mutex_unlock(&_res_cache_list_lock);
}
@@ -1860,8 +1859,10 @@
for (i = 0; i <= MAXNS; i++) {
free(cache_info->nameservers[i]);
cache_info->nameservers[i] = NULL;
- freeaddrinfo(cache_info->nsaddrinfo[i]);
- cache_info->nsaddrinfo[i] = NULL;
+ if (cache_info->nsaddrinfo[i] != NULL) {
+ freeaddrinfo(cache_info->nsaddrinfo[i]);
+ cache_info->nsaddrinfo[i] = NULL;
+ }
}
}