From nobody Mon Feb 9 20:35:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508247817808383.508645148499; Tue, 17 Oct 2017 06:43:37 -0700 (PDT) Received: from localhost ([::1]:39448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4S9h-0006Od-3e for importer@patchew.org; Tue, 17 Oct 2017 09:43:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4S7e-0004rV-EP for qemu-devel@nongnu.org; Tue, 17 Oct 2017 09:41:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4S7a-0007z5-JO for qemu-devel@nongnu.org; Tue, 17 Oct 2017 09:41:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41032) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e4S7a-0007yg-DE for qemu-devel@nongnu.org; Tue, 17 Oct 2017 09:41:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A504EC0C9; Tue, 17 Oct 2017 13:41:25 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F50E60852; Tue, 17 Oct 2017 13:41:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6A504EC0C9 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=imammedo@redhat.com From: Igor Mammedov To: qemu-devel@nongnu.org Date: Tue, 17 Oct 2017 15:41:19 +0200 Message-Id: <1508247680-98800-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1508247680-98800-1-git-send-email-imammedo@redhat.com> References: <1508247680-98800-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 17 Oct 2017 13:41:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/2] s390x: fix cpu object referrence leak in s390x_new_cpu() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Christian Borntraeger , Cornelia Huck , Alexander Graf , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" object_new() returns cpu with refcnt =3D=3D 1 and after realize refcnt =3D=3D 2*. s390x_new_cpu() as an owner of the first refcnt should have released it on exit in both cases (on error and success) to avoid it leaking. Do so for both cases. Signed-off-by: Igor Mammedov --- target/s390x/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/helper.c b/target/s390x/helper.c index 97adbcc..64d4c48 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -80,9 +80,9 @@ S390CPU *s390x_new_cpu(const char *typename, uint32_t cor= e_id, Error **errp) object_property_set_bool(OBJECT(cpu), true, "realized", &err); =20 out: + object_unref(OBJECT(cpu)); if (err) { error_propagate(errp, err); - object_unref(OBJECT(cpu)); cpu =3D NULL; } return cpu; --=20 2.7.4