mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 16:06:57 +00:00
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. Backports commit 1590d266d96b3f9b42443d6388dfc38f527ac2d8 from qemu
This commit is contained in:
parent
484a9cc21b
commit
a439a8c701
|
@ -1543,7 +1543,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(struct uc_struct *uc, Object *obj, struct Visitor *v, void *opaque,
|
||||
|
@ -1576,6 +1576,7 @@ static void property_release_alias(struct uc_struct *uc, Object *obj, const char
|
|||
{
|
||||
AliasProperty *prop = opaque;
|
||||
|
||||
g_free(prop->target_name);
|
||||
g_free(prop);
|
||||
}
|
||||
|
||||
|
@ -1603,7 +1604,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,
|
||||
|
|
Loading…
Reference in a new issue