qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qom: removal of link property need to release its target
@ 2012-08-22  3:02 Liu Ping Fan
  2012-08-22 12:02 ` Paolo Bonzini
  2012-08-22 17:07 ` Andreas Färber
  0 siblings, 2 replies; 10+ messages in thread
From: Liu Ping Fan @ 2012-08-22  3:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: Liu Ping Fan, Anthony Liguori

From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>

Currently, link property's target is only managed by
object_set_link_property(). This will raise such issue that when
the property is finalized, its target has no opportunity to release.

Fix this issue by introduce object_finalize_link_property()

Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
 qom/object.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/qom/object.c b/qom/object.c
index a552be2..76b3d34 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -957,6 +957,16 @@ static void object_set_link_property(Object *obj, Visitor *v, void *opaque,
     }
 }
 
+static void object_finalize_link_property(Object *obj, const char *name,
+                                           void *opaque)
+{
+    Object **child = opaque;
+
+    if (*child != NULL) {
+        object_unref(*child);
+    }
+}
+
 void object_property_add_link(Object *obj, const char *name,
                               const char *type, Object **child,
                               Error **errp)
@@ -968,7 +978,7 @@ void object_property_add_link(Object *obj, const char *name,
     object_property_add(obj, name, full_type,
                         object_get_link_property,
                         object_set_link_property,
-                        NULL, child, errp);
+                        object_finalize_link_property, child, errp);
 
     g_free(full_type);
 }
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-08-23  8:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-22  3:02 [Qemu-devel] [PATCH] qom: removal of link property need to release its target Liu Ping Fan
2012-08-22 12:02 ` Paolo Bonzini
2012-08-22 16:36   ` Anthony Liguori
2012-08-22 20:55     ` Paolo Bonzini
2012-08-22 21:41       ` Anthony Liguori
2012-08-22 22:01         ` Paolo Bonzini
2012-08-22 22:40           ` Anthony Liguori
2012-08-23  8:35             ` Paolo Bonzini
2012-08-23  8:02     ` liu ping fan
2012-08-22 17:07 ` Andreas Färber

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).