From 92425f097dc28e9518f5608bff2fce16f9b4f0ef Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Thu, 28 Jul 2011 17:21:17 -0700 Subject: [PATCH] Don't call freeaddrinfo with a NULL ptr. bug:5067055 Change-Id: I863dc4760a0aa449ac6298397ed571d8d9287801 --- libc/netbsd/resolv/res_cache.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libc/netbsd/resolv/res_cache.c b/libc/netbsd/resolv/res_cache.c index efce7dc98..20f37e106 100644 --- a/libc/netbsd/resolv/res_cache.c +++ b/libc/netbsd/resolv/res_cache.c @@ -1860,8 +1860,10 @@ _free_nameservers_locked(struct resolv_cache_info* cache_info) 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; + } } }