From patchwork Mon Mar 18 08:48:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ivanhu X-Patchwork-Id: 1913033 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TypRP1TTmz1yWy for ; Mon, 18 Mar 2024 19:48:33 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rm8fT-0006X8-5E; Mon, 18 Mar 2024 08:48:27 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rm8fP-0006Vp-Cc for fwts-devel@lists.ubuntu.com; Mon, 18 Mar 2024 08:48:23 +0000 Received: from canonical.com (unknown [10.101.194.165]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 3C65640EA5 for ; Mon, 18 Mar 2024 08:48:21 +0000 (UTC) From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH] opal: fix the resource leak for cpus Date: Mon, 18 Mar 2024 16:48:13 +0800 Message-Id: <20240318084813.113005-2-ivan.hu@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240318084813.113005-1-ivan.hu@canonical.com> References: <20240318084813.113005-1-ivan.hu@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" BugLink: https://bugs.launchpad.net/fwts/+bug/2058217 Fix resource leak found by coverity, CID 323867: (#1 of 1): Resource leak (RESOURCE_LEAK) 25. leaked_storage: Variable cpus going out of scope leaks the storage it points to. Signed-off-by: Ivan Hu --- src/opal/cpu_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opal/cpu_info.c b/src/opal/cpu_info.c index c96a419a..10c3c4ed 100644 --- a/src/opal/cpu_info.c +++ b/src/opal/cpu_info.c @@ -203,9 +203,9 @@ static int get_linux_xscom_devices(fwts_framework *fw) failures++; } fwts_log_nl(fw); - free(cpus); free(namelist[i]); } + free(cpus); } free(namelist);