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 14feb6fa6ddcdf41b353d6cd82c0c2347c1f9701..3957b4866df5624e00e21e1056faad3beaba46a2 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));