summaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32/0001-resolv-fix-res_close-not-to-hang-with-ipv6.patch
blob: 4567817f11291feb9dcab8ac537a55bf6b3caf7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 0256aca9b486f77af72ea941dfc852c2c4cff15b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Fri, 8 Apr 2011 11:51:03 +0300
Subject: [PATCH] resolv: fix res_close not to hang with ipv6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The memory release loop is missing an obvious counter increment.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
---
 libc/inet/resolv.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 47bab75..1e394d4 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -3006,9 +3006,9 @@ void res_close(void)
 #ifdef __UCLIBC_HAS_IPV6__
 	{
 		char *p1 = (char*) &(_res.nsaddr_list[0]);
-		int m = 0;
+		int m;
 		/* free nsaddrs[m] if they do not point to nsaddr_list[x] */
-		while (m < ARRAY_SIZE(_res._u._ext.nsaddrs)) {
+		for (m = 0; m < ARRAY_SIZE(_res._u._ext.nsaddrs); m++) {
 			char *p2 = (char*)(_res._u._ext.nsaddrs[m]);
 			if (p2 < p1 || (p2 - p1) > sizeof(_res.nsaddr_list))
 				free(p2);
-- 
1.7.1