From patchwork Wed Dec 18 16:59:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 303000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5985B2C007B for ; Thu, 19 Dec 2013 04:25:31 +1100 (EST) Received: from localhost ([::1]:39855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtKsC-0004RC-Ce for incoming@patchwork.ozlabs.org; Wed, 18 Dec 2013 12:25:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtKpv-00010q-0v for qemu-devel@nongnu.org; Wed, 18 Dec 2013 12:23:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtKpn-00008N-NL for qemu-devel@nongnu.org; Wed, 18 Dec 2013 12:23:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtKpn-00007q-EZ for qemu-devel@nongnu.org; Wed, 18 Dec 2013 12:22:59 -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 rBIHMwaS012415 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 18 Dec 2013 12:22:58 -0500 Received: from localhost (ovpn-113-56.phx2.redhat.com [10.3.113.56]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rBIH0FwB021502; Wed, 18 Dec 2013 12:00:15 -0500 From: Luiz Capitulino To: anthony@codemonkey.ws Date: Wed, 18 Dec 2013 11:59:59 -0500 Message-Id: <1387386003-8949-10-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1387386003-8949-1-git-send-email-lcapitulino@redhat.com> References: <1387386003-8949-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 09/13] qom: fix leak for objects created with -object X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Paolo Bonzini The object must be unref-ed when its variable goes out of scope. Signed-off-by: Paolo Bonzini Reviewed-By: Igor Mammedov Signed-off-by: Luiz Capitulino --- vl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 1f189d3..fcf2cc3 100644 --- a/vl.c +++ b/vl.c @@ -2811,12 +2811,13 @@ static int object_create(QemuOpts *opts, void *opaque) obj = object_new(type); if (qemu_opt_foreach(opts, object_set_property, obj, 1) < 0) { + object_unref(obj); return -1; } object_property_add_child(container_get(object_get_root(), "/objects"), id, obj, NULL); - + object_unref(obj); return 0; }