From patchwork Fri Feb 21 03:36:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 1241817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=201602 header.b=XkGr2n1g; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Ny7v0hg2z9sPk for ; Fri, 21 Feb 2020 14:47:06 +1100 (AEDT) Received: from localhost ([::1]:51848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4zHL-00012C-PL for incoming@patchwork.ozlabs.org; Thu, 20 Feb 2020 22:47:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49759) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4z88-0002Vl-Hg for qemu-devel@nongnu.org; Thu, 20 Feb 2020 22:37:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j4z86-0000HL-Am for qemu-devel@nongnu.org; Thu, 20 Feb 2020 22:37:32 -0500 Received: from ozlabs.org ([203.11.71.1]:59453) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j4z85-0008Pj-Uk; Thu, 20 Feb 2020 22:37:30 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 48NxwL0xJ0z9sSx; Fri, 21 Feb 2020 14:37:05 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1582256226; bh=Wp+k5nVHvdO925ifSYOaM86yY3mKvDBuJKP7l44HrBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XkGr2n1geUz2ar+oKYnbMSD3Si3DWimZQgI+vQfmmys0z5d3i0a+E908Oyg+AVtQV hDy4TNkJ1uKelS23bnUL3wK9PbvDuGMyk1EDXSSUf74l1WElcKJiAtn35p5p4kJh1b fQhHs1Wa0gHf7gBeZEEI8LE60gOO01P/Ikxmozp0= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 20/20] hw/ppc/virtex_ml507:fix leak of fdevice tree blob Date: Fri, 21 Feb 2020 14:36:50 +1100 Message-Id: <20200221033650.444386-21-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200221033650.444386-1-david@gibson.dropbear.id.au> References: <20200221033650.444386-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, aik@ozlabs.ru, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, Euler Robot , Chen Qun , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Chen Qun The device tree blob returned by load_device_tree is malloced. We should free it after cpu_physical_memory_write(). Reported-by: Euler Robot Signed-off-by: Chen Qun Message-Id: <20200218091154.21696-3-kuhn.chenqun@huawei.com> Signed-off-by: David Gibson --- hw/ppc/virtex_ml507.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index 91dd00ee91..4eef70069f 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -188,6 +188,7 @@ static int xilinx_load_device_tree(hwaddr addr, if (r < 0) fprintf(stderr, "couldn't set /chosen/bootargs\n"); cpu_physical_memory_write(addr, fdt, fdt_size); + g_free(fdt); return fdt_size; }