From 45ba627d08f268d3f0ed61625aa4715321a6d2b5 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Wed, 25 Mar 2009 22:49:10 +0200 Subject: [PATCH] Fix memory leaks in champlain_network_map_source_get_tile_uri --- champlain/champlain-network-map-source.c | 7 ++++--- champlain/champlain-network-map-source.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/champlain/champlain-network-map-source.c b/champlain/champlain-network-map-source.c index 2943079..3efb38a 100644 --- a/champlain/champlain-network-map-source.c +++ b/champlain/champlain-network-map-source.c @@ -225,7 +225,7 @@ champlain_network_map_source_new_full (const gchar *name, return network_map_source; } -const gchar * +gchar * champlain_network_map_source_get_tile_uri (ChamplainNetworkMapSource *network_map_source, gint x, gint y, @@ -260,7 +260,7 @@ champlain_network_map_source_get_tile_uri (ChamplainNetworkMapSource *network_ma g_string_append (ret, value); } else - g_string_append (ret, token); + g_string_append (ret, g_strdup (token)); token = tokens[++i]; } @@ -520,7 +520,7 @@ champlain_network_map_source_get_tile (ChamplainMapSource *map_source, else if (!priv->offline) { SoupMessage *msg; - const gchar *uri; + gchar *uri; FileLoadedCallbackContext *ctx = g_new0 (FileLoadedCallbackContext, 1); ctx->view = view; ctx->zoom_level = zoom_level; @@ -540,6 +540,7 @@ champlain_network_map_source_get_tile (ChamplainMapSource *map_source, soup_session_queue_message (soup_session, msg, file_loaded_cb, ctx); + g_free (uri); } /* If a tile is neither in cache or can be fetched, do nothing, it'll show up * as empty diff --git a/champlain/champlain-network-map-source.h b/champlain/champlain-network-map-source.h index 5009d54..1ec0303 100644 --- a/champlain/champlain-network-map-source.h +++ b/champlain/champlain-network-map-source.h @@ -63,7 +63,7 @@ ChamplainMapSource * champlain_map_source_new_osm_osmarender (void); ChamplainMapSource * champlain_map_source_new_oam (void); ChamplainMapSource * champlain_map_source_new_mff_relief (void); -const gchar * champlain_network_map_source_get_tile_uri (ChamplainNetworkMapSource *source, +gchar * champlain_network_map_source_get_tile_uri (ChamplainNetworkMapSource *source, gint x, gint y, gint z); void champlain_network_map_source_set_tile_uri (ChamplainNetworkMapSource *network_map_source, -- 2.39.5