From patchwork Mon Oct 28 12:48:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2003268 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=L8p7efVN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XcYBG2c7Pz1xw0 for ; Mon, 28 Oct 2024 23:49:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C7ED0890F8; Mon, 28 Oct 2024 13:48:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="L8p7efVN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5CE5F8916B; Mon, 28 Oct 2024 13:48:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 67A7E890BB for ; Mon, 28 Oct 2024 13:48:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5c9454f3bfaso5019137a12.2 for ; Mon, 28 Oct 2024 05:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730119719; x=1730724519; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eUiTJtjqMXIq9jpetlZI/rgVPq4fWekFjsdgZ1J+nDI=; b=L8p7efVN9MqxUdBPNfGMd0XVmkosMRN0qL6VhXWAIwthA2RAScDGDHMJeWykbYWSVE 0k5kJSKyHBPtP4yz0sBqqeRfGMBwhPIxJeHgHyFMGtwtldBjCcVRpAkXZWqo9XehKx68 WLiXS7V9vMAJBapORXKrlg11deYUhaE2tDFac= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730119719; x=1730724519; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eUiTJtjqMXIq9jpetlZI/rgVPq4fWekFjsdgZ1J+nDI=; b=bb+Nd45us4moqPnwT6lzY/3GQGdXb4fZiy5TmqKBHBJBUdNvmLuUohExOKKruA1AKE 2wtnBU8zIH/p3bizaCW0JLV1CV85tDOlvSxF5JZ8NmqxWD8RxoAuYmkXwTsTyfr/7+eo +tCWI529NDdDhneZ2HFMoZ2IbjGFLoNRRF3WBVZpGk74aMo6sWt/dL33B4jHk/hi66F6 uTe3Qy9tx07mx9U/L56XQujc9SJtnbke4KknTFvtY1fBEjLusSkTsmrE20QMRhfzooHA oBa/ubpDNWJch9gA4SZrpXoWc20UYPAyTAcoQG7d12wxBbQaGtxLgcaFDiyUMBPFAAJV iNyQ== X-Gm-Message-State: AOJu0YxKbgAerLCBM15+h7eFvvlBv05R22pborK5B7T1oHSy/y+BiHBq Bo1S5RuiT77HOWsc4gaSR5GJQfvcqF1MUWTFKyOa62x5sB5og3qnh1C+AfCww1T98/89IU+ysDl PBg== X-Google-Smtp-Source: AGHT+IFKX3X8EIEXsRqfGWZUGMabcW1Vt3gQ36+e/XOKKrp6FPPAiNoRwsay96MB1cDyfk1jWFVdBQ== X-Received: by 2002:a17:907:94cb:b0:a9a:33c:f6e1 with SMTP id a640c23a62f3a-a9de5c9f681mr768289866b.5.1730119718801; Mon, 28 Oct 2024 05:48:38 -0700 (PDT) Received: from chromium.org (43-114-103-145.static.glaslokaal.nl. [145.103.114.43]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b30d6fdc5sm375593366b.163.2024.10.28.05.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 05:48:37 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Tom Rini , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Masahisa Kojima Subject: [PATCH 09/15] efi_loader: Fix free in ..._media_device_boot_option() Date: Mon, 28 Oct 2024 13:48:00 +0100 Message-ID: <20241028124815.47262-10-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241028124815.47262-1-sjg@chromium.org> References: <20241028124815.47262-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Freeing a NULL pointer is an error in EFI, so check the pointer first, before freeing it. Signed-off-by: Simon Glass --- lib/efi_loader/efi_bootmgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index a3aa2b8d1b9..431a38704e9 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -1180,7 +1180,8 @@ out: free(opt[i].lo); } free(opt); - efi_free_pool(handles); + if (handles) + efi_free_pool(handles); if (ret == EFI_NOT_FOUND) return EFI_SUCCESS;