From 4dabdab2b42ae5f1789f5b8bc8f240c1c879d3d0 Mon Sep 17 00:00:00 2001 From: taesub kim Date: Thu, 9 Feb 2017 13:42:53 +0900 Subject: [PATCH] Fixed memory leak Change-Id: I521ae16389a37896444e6a0d7f2c87d0e2f14381 Signed-off-by: Taesub Kim --- dvpnlib/src/dvpnlib-vpn-connnection.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dvpnlib/src/dvpnlib-vpn-connnection.c b/dvpnlib/src/dvpnlib-vpn-connnection.c index a339fb3..c4f5aa4 100755 --- a/dvpnlib/src/dvpnlib-vpn-connnection.c +++ b/dvpnlib/src/dvpnlib-vpn-connnection.c @@ -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); } } -- 2.7.4