From ec1cabde2872337a98b1f5fb8e1e9b8219548010 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 30 Oct 2013 22:39:32 +0100 Subject: [PATCH] core: fix error in print_vpn_config to print the route correctly ip_address_to_string returns a static buffer, need to make a copy in this case. Signed-off-by: Thomas Haller --- src/vpn-manager/nm-vpn-connection.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c index a3074aa..7d3582a 100644 --- a/src/vpn-manager/nm-vpn-connection.c +++ b/src/vpn-manager/nm-vpn-connection.c @@ -576,11 +576,13 @@ print_vpn_config (NMVPNConnection *connection) num = nm_ip4_config_get_num_routes (priv->ip4_config); for (i = 0; i < num; i++) { const NMPlatformIP4Route *route = nm_ip4_config_get_route (priv->ip4_config, i); + char *s = g_strdup (ip_address_to_string (route->gateway)); nm_log_info (LOGD_VPN, " Static Route: %s/%d Next Hop: %s", ip_address_to_string (route->network), route->plen, - ip_address_to_string (route->gateway)); + s); + g_free (s); } nm_log_info (LOGD_VPN, " Forbid Default Route: %s", @@ -615,11 +617,13 @@ print_vpn_config (NMVPNConnection *connection) num = nm_ip6_config_get_num_routes (priv->ip6_config); for (i = 0; i < num; i++) { const NMPlatformIP6Route *route = nm_ip6_config_get_route (priv->ip6_config, i); + char *s = g_strdup (ip6_address_to_string (&route->gateway)); nm_log_info (LOGD_VPN, " Static Route: %s/%d Next Hop: %s", ip6_address_to_string (&route->network), route->plen, - ip6_address_to_string (&route->gateway)); + s); + g_free (s); } nm_log_info (LOGD_VPN, " Forbid Default Route: %s", -- 1.8.4.2