[PATCH 4/5] gps.c: Fixed a small memory leak

Lubomir I. Ivanov neolit123 at gmail.com
Wed Feb 20 17:07:21 PST 2013


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

osm_gps_map_get_default_cache_directory() uses stdc:strdup to allocate
memory for the returned string. Lets try to free the memory
pointed by 'cachebasedir'.

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 gps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gps.c b/gps.c
index 899db81..494eed5 100644
--- a/gps.c
+++ b/gps.c
@@ -187,6 +187,7 @@ OsmGpsMap *init_map(void)
 	osm_gps_map_layer_add(OSM_GPS_MAP(map), osd);
 	g_object_unref(G_OBJECT(osd));
 	free((void*)cachebasedir);
+	free((void*)cachedir);
 	return map;
 }
 
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list