Fixed memory leak 26/113826/1 accepted/tizen/common/20170214.173423 accepted/tizen/ivi/20170214.011145 accepted/tizen/mobile/20170214.011109 accepted/tizen/tv/20170214.011122 accepted/tizen/wearable/20170214.011133 submit/tizen/20170213.093416
authortaesub kim <taesub.kim@samsung.com>
Thu, 9 Feb 2017 04:42:53 +0000 (13:42 +0900)
committertaesub kim <taesub.kim@samsung.com>
Thu, 9 Feb 2017 04:43:14 +0000 (13:43 +0900)
Change-Id: I521ae16389a37896444e6a0d7f2c87d0e2f14381
Signed-off-by: Taesub Kim <taesub.kim@samsung.com>
dvpnlib/src/dvpnlib-vpn-connnection.c

index a339fb3..c4f5aa4 100755 (executable)
@@ -291,16 +291,22 @@ static void parse_connection_property_user_routes(
                                const char *property_value =
                                        g_variant_get_string(value, NULL);
                                DBG("Network is %s", property_value);
+                               if (route->network)
+                                       g_free(route->network);
                                route->network = g_strdup(property_value);
                        } else if (!g_strcmp0(key, "Netmask")) {
                                const char *property_value =
                                        g_variant_get_string(value, NULL);
                                DBG("Netmask is %s", property_value);
+                               if (route->netmask)
+                                       g_free(route->netmask);
                                route->netmask = g_strdup(property_value);
                        } else if (!g_strcmp0(key, "Gateway")) {
                                const char *property_value =
                                        g_variant_get_string(value, NULL);
                                DBG("Gateway is %s", property_value);
+                               if (route->gateway)
+                                       g_free(route->gateway);
                                route->gateway = g_strdup(property_value);
                        }
                }
@@ -355,16 +361,22 @@ static void parse_connection_property_server_routes(
                                const char *property_value =
                                        g_variant_get_string(value, NULL);
                                DBG("Network is %s", property_value);
+                               if (route->network)
+                                       g_free(route->network);
                                route->network = g_strdup(property_value);
                        } else if (!g_strcmp0(key, "Netmask")) {
                                const char *property_value =
                                        g_variant_get_string(value, NULL);
                                DBG("Netmask is %s", property_value);
+                               if (route->netmask)
+                                       g_free(route->netmask);
                                route->netmask = g_strdup(property_value);
                        } else if (!g_strcmp0(key, "Gateway")) {
                                const char *property_value =
                                        g_variant_get_string(value, NULL);
                                DBG("Gateway is %s", property_value);
+                               if (route->gateway)
+                                       g_free(route->gateway);
                                route->gateway = g_strdup(property_value);
                        }
                }