From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhMu5-00069H-Eq for qemu-devel@nongnu.org; Fri, 15 Nov 2013 12:10:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VhMtz-0007hl-FU for qemu-devel@nongnu.org; Fri, 15 Nov 2013 12:09:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VhMtz-0007hP-7c for qemu-devel@nongnu.org; Fri, 15 Nov 2013 12:09:51 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rAFH9oHY024709 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Nov 2013 12:09:50 -0500 From: Vlad Yasevich Date: Fri, 15 Nov 2013 12:09:47 -0500 Message-Id: <1384535387-6290-1-git-send-email-vyasevic@redhat.com> Subject: [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: qemu-devel@nongnu.org Cc: Vlad Yasevich 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); } Object *object_property_get_link(Object *obj, const char *name, -- 1.8.4.2