| Message ID | 20260416023021.626949-19-sjg@u-boot.org |
|---|---|
| State | New |
| Headers |
Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776306679; bh=0/RzoFG8IdZaCPIzUcXtVzYCQu1wADUKx2fFLPyME+8=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=eIUnDxqeWM9booeGr7FgoRt8UDbVHV/qiX/V6mYDMcO7Ug1rRSwqzLM7WPZsJTSFS 01ymGmTZzIIVnfie7M/a0pfd+IErAPnwNqAfMWix8y08HeSuCASbZ+Q/mZrU3SEj0T GkTe6bdk251XlbKmo5V9xLaoui4U1aqYPCoUp4VY= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5702F6A44C for <u-boot-concept@u-boot.org>; Wed, 15 Apr 2026 20:31:19 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id y4EpVJH7pyeB for <u-boot-concept@u-boot.org>; Wed, 15 Apr 2026 20:31:19 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776306674; bh=0/RzoFG8IdZaCPIzUcXtVzYCQu1wADUKx2fFLPyME+8=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=NKKB7FCVvhdztcpIDsv8Zt+35vnaYtgVXiv7B8REqfRYj2Kl3TP6nlVStFOfe9/f+ LyM7hPoHhpO8qcToCiPxl+MJ4IGFZ6IzvxVsv7doxdYm8Zup3zeKjwP/scVTU1/d8X 0wPUxbQG6OcCt1v7u/e+nghrq77Eu+0J6c/aONiY= Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 240806A48B for <u-boot-concept@u-boot.org>; Wed, 15 Apr 2026 20:31:14 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776306672; bh=fDmX+xF8wYLE+9G+pNy4dBkI0zNpS/V1gafqA3PyEpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NIGd3BHjt/DMAR0/Q3ia3/EjD7ylPRmMiWAEkpfeU5kmSuuGZqoeajIWrI5uEyrfj xPrittycNFgj4YVUUdKKDxdT0o8M29sRnBRDu9GmAvjKPNw66BB+jGgM+qMyripZvf xrugTmdayVcjlkXrmpwqT9qYEiYtMyZF9H6xn2vI= Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3014B6A4A5; Wed, 15 Apr 2026 20:31:12 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id WaBF8DdcgR3L; Wed, 15 Apr 2026 20:31:12 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1776306666; bh=HqK27vqDz4cmkTx5lB04tt/ySa79nvx8MI2c5nAr6r0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQSPZ0WaFY7CuMyzzWOo6N+MeBGc8k+/LAFmfRIwoVilZwJszmdsSm1nR/31gRyAn b8mBEYIn2PvbjlzclHAkhYoOu415Lf8Hf+SrvPVUKg5yrtAEgpVYo5h+QXC0MBcPbo 10av4WUCMja0w+zMVUSxE1wyGzlcvYBoTzfVcMiQ= Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 577056A4B0; Wed, 15 Apr 2026 20:31:06 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Wed, 15 Apr 2026 20:29:43 -0600 Message-ID: <20260416023021.626949-19-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260416023021.626949-1-sjg@u-boot.org> References: <20260416023021.626949-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 6ADAUSTVQP5E6TGM4XRIZIKCDDNQJSQJ X-Message-ID-Hash: 6ADAUSTVQP5E6TGM4XRIZIKCDDNQJSQJ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass <sjg@chromium.org> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 18/33] bootctl: Destroy the UI expo when the device is removed List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/6ADAUSTVQP5E6TGM4XRIZIKCDDNQJSQJ/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit |
| Series |
Fix memory leaks and test pollution in sandbox tests
|
|
Commit Message
Simon Glass
April 16, 2026, 2:29 a.m. UTC
From: Simon Glass <sjg@chromium.org> The bootctrl_ui uclass allocates a bc_ui_priv per device, and UI drivers (multiboot_ui, simple_ui) populate upriv->expo via bootflow_menu_setup() or build their own via expo_new() Neither is freed when the device goes away, so the expo and every scene, string and object hung off it are leaked - about 50 KB per logic_tkey run. Add a pre_remove hook on the uclass to destroy the expo and release the autoboot_template abuf. Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/bootctl/bootctl-uclass.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/boot/bootctl/bootctl-uclass.c b/boot/bootctl/bootctl-uclass.c index 756702b3e9a..3f06668a199 100644 --- a/boot/bootctl/bootctl-uclass.c +++ b/boot/bootctl/bootctl-uclass.c @@ -8,8 +8,10 @@ #define LOG_CATEGORY UCLASS_BOOTCTL +#include <abuf.h> #include <bootctl.h> #include <dm.h> +#include <expo.h> #include <bootctl/ui.h> UCLASS_DRIVER(bootctrl) = { @@ -39,9 +41,21 @@ UCLASS_DRIVER(bootctrl_state) = { .per_device_plat_auto = sizeof(struct bootctl_uc_plat), }; +static int bootctl_ui_pre_remove(struct udevice *dev) +{ + struct bc_ui_priv *upriv = dev_get_uclass_priv(dev); + + if (upriv->expo) + expo_destroy(upriv->expo); + abuf_uninit(&upriv->autoboot_template); + + return 0; +} + UCLASS_DRIVER(bootctrl_ui) = { .id = UCLASS_BOOTCTL_UI, .name = "bootctrl_ui", + .pre_remove = bootctl_ui_pre_remove, .per_device_plat_auto = sizeof(struct bootctl_uc_plat), .per_device_auto = sizeof(struct bc_ui_priv), };