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>
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,
{
AliasProperty *prop = opaque;
+ g_free(prop->target_name);
g_free(prop);
}
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,