fix a memleak in host route dependency handling
authorFelix Fietkau <nbd@openwrt.org>
Mon, 18 Jun 2012 21:16:25 +0000 (23:16 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 18 Jun 2012 21:16:29 +0000 (23:16 +0200)
interface-ip.c

index 14feb6f..3957b48 100644 (file)
@@ -160,8 +160,10 @@ interface_ip_add_target_route(union if_addr *addr, bool v6)
                interface_ip_find_route_target(iface, addr, v6, &r_next);
        }
 
-       if (!r_next)
+       if (!r_next) {
+               free(route);
                return NULL;
+       }
 
        iface = r_next->iface;
        memcpy(&route->nexthop, &r_next->nexthop, sizeof(route->nexthop));