From patchwork Thu Dec 7 09:20:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 751060 Delivered-To: patch@linaro.org Received: by 2002:adf:a499:0:b0:333:3a04:f257 with SMTP id g25csp320685wrb; Thu, 7 Dec 2023 01:20:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHi6o+kuGnDNcp2iOhPpgqKe72Wx6am+2ZcADu/OhWyQT/R4i5WzLTKEcbMCHaB/eN4affk X-Received: by 2002:a19:550d:0:b0:50b:ccc2:e213 with SMTP id n13-20020a19550d000000b0050bccc2e213mr1142358lfe.17.1701940823042; Thu, 07 Dec 2023 01:20:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701940823; cv=none; d=google.com; s=arc-20160816; b=yD0pA3XdoUrX3aUg7TpzTKhOdYsV3oT7ndI1ncXDEKI2stpbf2eyE+2WgW5jmnf/Gm J3DhZw/rGoiOVTduzto4Gj3sR3GYgOLyeWkx7ct31GgxOCKuczFxzyQCfA3oE+bd1NlE RDS/n0w23QEP8nvdKG4GAsTn2oEwwhDeCAaHvqoLqMO38t5GeIIww/DiHTsk6ZC0Vner Lqj4/P85kVsguXSx6+YTuwDJt+t6nwe+EEWCrHJ2ruxS9ABxo3YeVMcPbTsE+N62EZbD 1XQb/dThz54F5vWJttjKccS1StDVadx64SP6V66cL3ZJkKzo9D4hu2iOrUiZI3VsQpbw isVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=anD6nQKmNBCgfQ+e2V57LoPqem7vMgnJfqzxIiJ5hKI=; fh=w81bbTLr0lUg+VHB+gXXD0h/KqkBqBSSTwyd71qOwLM=; b=KjGGWteTEslA/7vq7gMjzKmnVbDbYtk4F+9wwrh1QYCDYb6Ra3y4/6UXZPUi+Rd1qp X+nawmEFr8CZfXlBnl+7wgCpn3NMu5/wf9fIRA0yIwhOZCIvpW137Rs6cs6lMvZVcR3T KADqEfc3dxgpBUyQ2M8CJleqxjmI+HHN0BiONKrlq7gw+HbOtqG1Co6K+vT+gBiykbXu HROMDSX0h4wiWwKY9llbndody3HD5z7sOn9noOBwaZBUfR5PtLgwFf2KQ9HNEumKFhic 51tpfeJ8q2pwp2nWQq7rRBkJorXY1p/ihJ5yHrLVPuXNfNY0FecvGzT+vVLzfRP680s/ BPbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VB91xosu; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id k16-20020a05651239d000b0050bfa483142si326784lfu.434.2023.12.07.01.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 01:20:23 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VB91xosu; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D453D870F6; Thu, 7 Dec 2023 10:20:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="VB91xosu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6A7FD87243; Thu, 7 Dec 2023 10:20:20 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 277AB86F64 for ; Thu, 7 Dec 2023 10:20:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3316a4bc37dso675181f8f.2 for ; Thu, 07 Dec 2023 01:20:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701940816; x=1702545616; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=anD6nQKmNBCgfQ+e2V57LoPqem7vMgnJfqzxIiJ5hKI=; b=VB91xosu7yTfzcD2l70anPvACRONXJQOLWqvpFsY7Nqyt1C2rVfC886wz8Mntph+QE Zd18ADPulcbIOV1f7d0YiGS3KvM+B3ixgz1GD22prP/hlHO/qTvHicFcOXmOASmjZ2Z4 IZWO9ruCfMC5AwSQWN8YncMXOJFvePS8E1mOjDI1f7yTKHQ4pkQ568OHWKDZJqkt+OR6 ECZzgxYLDSOfFALLH2RDeDnrQIgIZqoQ99LWxy0t2YdcykNXa6/lE50eqjn2EREY4pzx JU71/iMMUTth/2eI2FDj5hpy0ycQD4ju8cLlI9lkMQleDB9rAZzCvU2oajJ1Ms754lR/ c3NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701940816; x=1702545616; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=anD6nQKmNBCgfQ+e2V57LoPqem7vMgnJfqzxIiJ5hKI=; b=ENhFcizVI2ruNkf1wwWum4lbyY1XhH4J7HdBFhXt+jgneqavhN/GRZ7MVRBbS5MuoI TqNU1QT8yp4GuEvJHsv+QcE04r3Q4AdXJn1BukLSvqsMbjurqde4cLIj7FyjEZgsXGLG GJ2LmJ9kOgs3zhSYrGO7gI5KP+JQEZLGA4PvGCs/4bgVAZeYskP68uatl7CBp+12wSR4 cb3/E/JD2YNFSjfO0FiAH1dAGpDqi6askramU4iNccO+TDOVwYv/t8uOx2+JvgjD84na x1xozCnoedMd9BSNccQzyjRKXLCToQFzOS5nL6Vmnl3NLjXRsBUsy3HafIm7rDBxYgnV gvHg== X-Gm-Message-State: AOJu0YwXpVsMN9vYBETH2uHeoPFNNk9W3I6uD0EyylFFwTXiCGQjeI7j yBad5S2tz4pkafkVLG7TrlHz6g== X-Received: by 2002:a5d:43c4:0:b0:334:b178:393e with SMTP id v4-20020a5d43c4000000b00334b178393emr875806wrr.123.1701940816629; Thu, 07 Dec 2023 01:20:16 -0800 (PST) Received: from localhost.localdomain (ppp046103111243.access.hol.gr. [46.103.111.243]) by smtp.gmail.com with ESMTPSA id m15-20020a056000180f00b00333332a8d39sm916660wrh.55.2023.12.07.01.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 01:20:15 -0800 (PST) From: Ilias Apalodimas To: sjg@chromium.org Cc: heinrich.schuchardt@canonical.com, Ilias Apalodimas , Mark Kettenis , u-boot@lists.denx.de Subject: [PATCH] bootstd: Fix a memory leak in the efi manager bootflow Date: Thu, 7 Dec 2023 11:20:12 +0200 Message-Id: <20231207092012.17914-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.40.1 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 efi_get_var() allocates memory which has to be freed after the value of the variable is consumed. Free the memory properly Fixes: f2bfa0cb1794 ("bootstd: Make efi_mgr bootmeth work for non-sandbox setups") Signed-off-by: Ilias Apalodimas --- boot/bootmeth_efi_mgr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/boot/bootmeth_efi_mgr.c b/boot/bootmeth_efi_mgr.c index e6c42d41fb80..530ad09cce83 100644 --- a/boot/bootmeth_efi_mgr.c +++ b/boot/bootmeth_efi_mgr.c @@ -65,6 +65,7 @@ static int efi_mgr_read_bootflow(struct udevice *dev, struct bootflow *bflow) bootorder = efi_get_var(u"BootOrder", &efi_global_variable_guid, &size); if (bootorder) { + free(bootorder); bflow->state = BOOTFLOWST_READY; return 0; }