From: woglinde Date: Sat, 16 Apr 2011 14:18:05 +0000 (+0000) Subject: Fix:core:Fix small memleak found with valgrind, wordexp isn't needed after the name... X-Git-Tag: navit-0.5.0.5194svn~766 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35316e93ebfadd8542f3bea20d0d1bf41c483185;p=profile%2Fivi%2Fnavit.git Fix:core:Fix small memleak found with valgrind, wordexp isn't needed after the name is set git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4429 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- diff --git a/navit/navit/navit.c b/navit/navit/navit.c index b80d5c7..1e27129 100644 --- a/navit/navit/navit.c +++ b/navit/navit/navit.c @@ -1416,7 +1416,7 @@ navit_former_destinations_active(struct navit *this_) static void navit_add_former_destinations_from_file(struct navit *this_) { - char *destination_file = bookmarks_get_destination_file(FALSE); + char *destination_file; struct attr *attrs[4]; struct map_rect *mr; struct item *item; @@ -1428,6 +1428,11 @@ navit_add_former_destinations_from_file(struct navit *this_) struct attr data; struct attr flags; + if (!this_->route || !navit_former_destinations_active(this_)) + return; + + destination_file = bookmarks_get_destination_file(FALSE); + parent.type=attr_navit; parent.u.navit=this_; @@ -1443,10 +1448,11 @@ navit_add_former_destinations_from_file(struct navit *this_) attrs[0]=&type; attrs[1]=&data; attrs[2]=&flags; attrs[3]=NULL; this_->former_destination=map_new(&parent, attrs); + g_free(destination_file); - if (!this_->route || !navit_former_destinations_active(this_)) - return; + mr=map_rect_new(this_->former_destination, NULL); + while ((item=map_rect_get_item(mr))) { if ((item->type == type_former_destination || item->type == type_former_itinerary || item->type == type_former_itinerary_part) && (count=item_coord_get(item, c, 16))) valid=1; @@ -3023,6 +3029,8 @@ navit_destroy(struct navit *this_) ms = navit_get_mapset(this_); if(ms) mapset_destroy(ms); + if(this_->former_destination) + map_destroy(this_->former_destination); graphics_free(this_->gra); g_free(this_); }