diff options
author | tegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-01-06 11:55:44 +0000 |
---|---|---|
committer | tegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-01-06 11:55:44 +0000 |
commit | da0a49827a822e176c5b3f4d6b0dfd8f48de039d (patch) | |
tree | 7f3ddc4a2b30a0d40ced7834203fc44b45454dc5 /navit/map/csv/csv.c | |
parent | 5ff4fe14e9a89d71c1b010bcf8a213c419bbc3dc (diff) | |
download | navit-da0a49827a822e176c5b3f4d6b0dfd8f48de039d.tar.gz |
Fix:map/csv:Fixed get_item_byid handling; removed memory leak
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3872 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/map/csv/csv.c')
-rw-r--r-- | navit/map/csv/csv.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/navit/map/csv/csv.c b/navit/map/csv/csv.c index e7e415405..573d87ac7 100644 --- a/navit/map/csv/csv.c +++ b/navit/map/csv/csv.c @@ -174,7 +174,7 @@ static struct item * map_rect_get_item_byid_csv(struct map_rect_priv *mr, int id_hi, int id_lo) { //currently id_hi is ignored - return g_hash_table_lookup(mr->m->item_hash,id_lo); + return g_hash_table_lookup(mr->m->item_hash,&id_lo); } static struct map_methods map_methods_csv = { @@ -193,7 +193,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs) struct map_priv *m = NULL; m = g_new0(struct map_priv, 1); m->id = ++map_id; - m->item_hash = g_hash_table_new(g_int_hash, g_int_equal); + m->item_hash = g_hash_table_new_full(g_int_hash, g_int_equal,g_free,g_free); struct attr *item_type = attr_search(attrs, NULL, attr_item_type); struct attr *attr_types = attr_search(attrs, NULL, attr_attr_types); @@ -301,7 +301,7 @@ map_new_csv(struct map_methods *meth, struct attr **attrs) } ++cnt; } - if(bAddSum) { + if(bAddSum && (longitude!=0.0 || latitude!=0.0)) { struct quadtree_data* qd = g_new0(struct quadtree_data,1); qd->item = curr_item; qd->attr_list = attr_list; @@ -310,7 +310,9 @@ map_new_csv(struct map_methods *meth, struct attr **attrs) qi->longitude = longitude; qi->latitude = latitude; quadtree_add(tree_root, qi); - g_hash_table_insert(m->item_hash, item_idx,curr_item); + int* pID = g_new(int,1); + *pID = item_idx; + g_hash_table_insert(m->item_hash, pID,curr_item); ++item_idx; } else { |