Fixed memory leak
[platform/core/connectivity/net-config.git] / src / network-state.c
index 02c60e0..1c08078 100755 (executable)
@@ -1351,10 +1351,6 @@ static gboolean handle_remove_route(
        gchar *const args[] = { "/sbin/route", "del", "-net", ip_addr, gw_str,
                "netmask", netmask, "dev", interface, NULL };
        char *const envs[] = { NULL };
-       const char* buf = NULL;
-       char* ch = NULL;
-       int prefix_len = 0;
-       int pos = 0;
 
        DBG("ip_addr(%s), netmask(%s), interface(%s), gateway(%s)", ip_addr, netmask, interface, gateway);
 
@@ -1378,17 +1374,7 @@ static gboolean handle_remove_route(
                        return TRUE;
                }
 
-               buf = ip_addr;
-               ch = strchr(buf, '/');
-               pos = ch - buf + 1;
-               if (ch) {
-                       prefix_len = atoi(ch + 1);
-                       ip_addr[pos-1] = '\0';
-               } else {
-                       prefix_len = 128;
-               }
-
-               if (netconfig_del_route_ipv6(ip_addr, interface, gateway, prefix_len) < 0) {
+               if (netconfig_del_route_ipv6(interface, gateway) < 0) {
                        DBG("Failed to remove the route");
                        netconfig_error_permission_denied(context);
                        return TRUE;