From nobody Sun May 5 07:05:52 2024 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 1500018724943536.1566887886142; Fri, 14 Jul 2017 00:52:04 -0700 (PDT) Received: from localhost ([::1]:36030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVvOF-0006us-02 for importer@patchew.org; Fri, 14 Jul 2017 03:51:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVvNJ-0006TX-Tm for qemu-devel@nongnu.org; Fri, 14 Jul 2017 03:50:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVvNG-0005lc-SL for qemu-devel@nongnu.org; Fri, 14 Jul 2017 03:50:58 -0400 Received: from 1.mo173.mail-out.ovh.net ([178.33.111.180]:40375) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVvNG-0005k1-L0 for qemu-devel@nongnu.org; Fri, 14 Jul 2017 03:50:54 -0400 Received: from player687.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id B22FE59EA7 for ; Fri, 14 Jul 2017 09:50:45 +0200 (CEST) Received: from bahia.lan (gar31-1-82-66-74-139.fbx.proxad.net [82.66.74.139]) (Authenticated sender: groug@kaod.org) by player687.ha.ovh.net (Postfix) with ESMTPA id 849362C0085; Fri, 14 Jul 2017 09:50:40 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Fri, 14 Jul 2017 09:50:40 +0200 Message-ID: <150001864048.7077.16008343547703241545.stgit@bahia.lan> User-Agent: StGit/0.17.1-20-gc0b1b-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 8634807862326696422 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelkedrfedvgddufeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.111.180 Subject: [Qemu-devel] [PATCH] spapr: fix memory leak in spapr_core_pre_plug() 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: qemu-ppc@nongnu.org, qemu-stable@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 In case of error, we must ensure the dynamically allocated base_core_type is freed, like it is done everywhere else in this function. This is a regression introduced in QEMU 2.9 by commit 8149e2992f78. Signed-off-by: Greg Kurz --- hw/ppc/spapr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 638b8243de04..ed9b57d1fc2a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3150,9 +3150,9 @@ static void spapr_core_pre_plug(HotplugHandler *hotpl= ug_dev, DeviceState *dev, * total vcpus not a multiple of threads-per-core. */ if (mc->has_hotpluggable_cpus && (cc->nr_threads !=3D smp_threads)) { - error_setg(errp, "invalid nr-threads %d, must be %d", + error_setg(&local_err, "invalid nr-threads %d, must be %d", cc->nr_threads, smp_threads); - return; + goto out; } =20 core_slot =3D spapr_find_cpu_slot(MACHINE(hotplug_dev), cc->core_id, &= index);