summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-11-26 20:39:20 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2009-11-26 20:39:20 +0000
commit7ad8326669dfb78b3eaf8d1575993078c856494b (patch)
tree12758e906fb31afc7302f629c760510df468e9e3 /navit
parent5b407be46d7c2d33e6eed0e3d86afc4e4a28f1f1 (diff)
downloadnavit-svn-7ad8326669dfb78b3eaf8d1575993078c856494b.tar.gz
Fix:Core:Correct attribute alloc and free
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@2804 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r--navit/attr.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/navit/attr.c b/navit/attr.c
index c4189956..a4b94659 100644
--- a/navit/attr.c
+++ b/navit/attr.c
@@ -147,7 +147,7 @@ attr_new_from_text(const char *name, const char *value)
break;
default:
if (attr >= attr_type_string_begin && attr <= attr_type_string_end) {
- ret->u.str=(char *)value;
+ ret->u.str=g_strdup(value);
break;
}
if (attr >= attr_type_int_begin && attr <= attr_type_int_end) {
@@ -494,10 +494,9 @@ attr_free(struct attr *attr)
{
if (!attr)
return;
- if (attr->type == attr_position_coord_geo)
- g_free(attr->u.coord_geo);
- if (attr->type >= attr_type_color_begin && attr->type <= attr_type_color_end)
- g_free(attr->u.color);
+ if (!(attr->type >= attr_type_int_begin && attr->type <= attr_type_int_end) &&
+ !(attr->type >= attr_type_object_begin && attr->type <= attr_type_object_end))
+ g_free(attr->u.data);
g_free(attr);
}