summaryrefslogtreecommitdiffstats
path: root/qom
diff options
context:
space:
mode:
authorEduardo Habkost2015-04-09 21:57:29 +0200
committerAndreas Färber2015-06-19 10:29:14 +0200
commit1590d266d96b3f9b42443d6388dfc38f527ac2d8 (patch)
treee275782435e002cfcd90796a4da81a990e397c9a /qom
parentMerge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-06-18' into ... (diff)
downloadqemu-1590d266d96b3f9b42443d6388dfc38f527ac2d8.tar.gz
qemu-1590d266d96b3f9b42443d6388dfc38f527ac2d8.tar.xz
qemu-1590d266d96b3f9b42443d6388dfc38f527ac2d8.zip
qom: strdup() target property name on object_property_add_alias()
With this, object_property_add_alias() callers can safely free the target property name, like what already happens with the 'name' argument to all object_property_add*() functions. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/qom/object.c b/qom/object.c
index 96abd347b1..d142d15644 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1705,7 +1705,7 @@ void object_property_add_uint64_ptr(Object *obj, const char *name,
typedef struct {
Object *target_obj;
- const char *target_name;
+ char *target_name;
} AliasProperty;
static void property_get_alias(Object *obj, struct Visitor *v, void *opaque,
@@ -1736,6 +1736,7 @@ static void property_release_alias(Object *obj, const char *name, void *opaque)
{
AliasProperty *prop = opaque;
+ g_free(prop->target_name);
g_free(prop);
}
@@ -1763,7 +1764,7 @@ void object_property_add_alias(Object *obj, const char *name,
prop = g_malloc(sizeof(*prop));
prop->target_obj = target_obj;
- prop->target_name = target_name;
+ prop->target_name = g_strdup(target_name);
op = object_property_add(obj, name, prop_type,
property_get_alias,