From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViJtl-0001c3-8A for qemu-devel@nongnu.org; Mon, 18 Nov 2013 03:09:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ViJtd-0004F2-4C for qemu-devel@nongnu.org; Mon, 18 Nov 2013 03:09:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViJtc-0004Ek-Ry for qemu-devel@nongnu.org; Mon, 18 Nov 2013 03:09:25 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAI89NYY031448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 18 Nov 2013 03:09:23 -0500 Date: Mon, 18 Nov 2013 16:09:18 +0800 From: Amos Kong Message-ID: <20131118080918.GA19020@amosk.info> References: <1384535387-6290-1-git-send-email-vyasevic@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1384535387-6290-1-git-send-email-vyasevic@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2] qom: Fix memory leak in object_property_set_link() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vlad Yasevich Cc: qemu-devel@nongnu.org On Fri, Nov 15, 2013 at 12:09:47PM -0500, Vlad Yasevich wrote: > Save the result of the call to object_get_cannonical_path() > so we can free it. > > Signed-off-by: Vlad Yasevich > --- > v1->v2: Builds and works :) > > qom/object.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/qom/object.c b/qom/object.c > index b617f26..fc19cf6 100644 > --- a/qom/object.c > +++ b/qom/object.c > @@ -838,8 +838,9 @@ char *object_property_get_str(Object *obj, const char *name, > void object_property_set_link(Object *obj, Object *value, > const char *name, Error **errp) > { > - object_property_set_str(obj, object_get_canonical_path(value), > - name, errp); > + gchar *path = object_get_canonical_path(value); > + object_property_set_str(obj, path, name, errp); > + g_free(path); Reviewed-by: Amos Kong > } > > Object *object_property_get_link(Object *obj, const char *name, > -- > 1.8.4.2 > -- Amos.