From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Crosthwaite" <peter.crosthwaite@xilinx.com>,
"Andreas Färber" <afaerber@suse.de>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] qom: strdup() target property name on object_property_add_alias()
Date: Thu, 9 Apr 2015 16:57:29 -0300 [thread overview]
Message-ID: <1428609450-29812-2-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1428609450-29812-1-git-send-email-ehabkost@redhat.com>
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>
---
qom/object.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index b8dff43..550dd48 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1689,7 +1689,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,
@@ -1720,6 +1720,7 @@ static void property_release_alias(Object *obj, const char *name, void *opaque)
{
AliasProperty *prop = opaque;
+ g_free(prop->target_name);
g_free(prop);
}
@@ -1747,7 +1748,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,
--
2.1.0
next prev parent reply other threads:[~2015-04-09 19:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-09 19:57 [Qemu-devel] [PATCH 0/2] qom: strdup() target_name on object_property_add_alias() Eduardo Habkost
2015-04-09 19:57 ` Eduardo Habkost [this message]
2015-04-09 19:57 ` [Qemu-devel] [PATCH 2/2] qdev: Free property names after registering gpio aliases Eduardo Habkost
2015-04-09 20:22 ` [Qemu-devel] [PATCH 0/2] qom: strdup() target_name on object_property_add_alias() Paolo Bonzini
2015-04-09 22:48 ` Andreas Färber
2015-04-28 3:16 ` Andreas Färber
2015-05-18 18:03 ` Eduardo Habkost
2015-04-10 12:04 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428609450-29812-2-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=afaerber@suse.de \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).