Skip to contentSkip to conversation

ipv6 addrconf: Fix memory leak when deleting addresses

PATCH New Thomas Graf 1 participant 1 message Jun 4, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6 addrconf: Fix memory leak when deleting addresses

ip6_del_rt() may fail in which case the dst/route is not released.

net/ipv6/addrconf.c +3 -3
Index: net-2.6/net/ipv6/addrconf.c
===================================================================
@@ -779,8 +779,8 @@
 
 		if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
 			if (onlink == 0) {
-				ip6_del_rt(rt);
-				rt = NULL;
+				if (ip6_del_rt(rt) == 0)
+					goto out;
 			} else if (!(rt->rt6i_flags & RTF_EXPIRES)) {
 				rt->rt6i_expires = expires;
 				rt->rt6i_flags |= RTF_EXPIRES;
@@ -788,7 +788,7 @@
 		}
 		dst_release(&rt->u.dst);
 	}
-
+out:
 	in6_ifa_put(ifp);
 }