From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T49dp-0007kZ-6B for qemu-devel@nongnu.org; Wed, 22 Aug 2012 08:02:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T49df-0006Mt-Me for qemu-devel@nongnu.org; Wed, 22 Aug 2012 08:02:33 -0400 Received: from mail-ey0-f173.google.com ([209.85.215.173]:37261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T49df-0006Mp-Fj for qemu-devel@nongnu.org; Wed, 22 Aug 2012 08:02:23 -0400 Received: by eaac13 with SMTP id c13so294926eaa.4 for ; Wed, 22 Aug 2012 05:02:22 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5034CA4C.7020706@redhat.com> Date: Wed, 22 Aug 2012 14:02:20 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1345604562-27289-1-git-send-email-qemulist@gmail.com> In-Reply-To: <1345604562-27289-1-git-send-email-qemulist@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qom: removal of link property need to release its target List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Ping Fan Cc: Liu Ping Fan , qemu-devel@nongnu.org, Anthony Liguori Il 22/08/2012 05:02, Liu Ping Fan ha scritto: > From: Liu Ping Fan > > 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 Acked-by: Paolo Bonzini Paolo > --- > 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); > } >