summaryrefslogtreecommitdiff
path: root/navit/attr.c
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
commita1b0a932410765fd2bc61e2c8ed8e7b659aed69b (patch)
tree12758e906fb31afc7302f629c760510df468e9e3 /navit/attr.c
parentf3769c10ed01adfbcc066686c044e49581742824 (diff)
downloadnavit-a1b0a932410765fd2bc61e2c8ed8e7b659aed69b.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/attr.c')
-rw-r--r--navit/attr.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/navit/attr.c b/navit/attr.c
index c41899561..a4b94659c 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);
}