| Message ID | 20260316183050.3855921-16-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=1773685896; bh=mVqdE7vdhPxv0h46t4gvne19/xEPFPubSe8903uyqos=; 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=HIGqZRMjYPEqJ6yxGXyTi1fJvKqvBBfiWNCLacMqqUSfrDIiDLRiRKVAmArfUVA/f qkOURwYZqLmmReFVVcR0RGH4Vy3mNpgdRHT50DapzuuJ2mTlO40Lt7nJRP277++jQW tLcleeZ05I4UpaoUCoWk1vdRyhOqR4iQhos7bI/S6M8TREvX1ibsFZPiFmpzxKvt4K ZAJ99mJn0pC+q6GbmnSb/5jzh4KS/RPWzcfDBFd6DYeEr6WkbdrAB+TdA+CTJ6aSe2 3QeApiLduzW8pTpb4ALjDytK7QM84rurDH8iIn4a5UwE8qt9DZeq6tRVmja3i0znl/ z3WDd/yszI3VA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4A3766A078 for <u-boot-concept@u-boot.org>; Mon, 16 Mar 2026 12:31:36 -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 6ciTf6yOHBa1 for <u-boot-concept@u-boot.org>; Mon, 16 Mar 2026 12:31:36 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685896; bh=mVqdE7vdhPxv0h46t4gvne19/xEPFPubSe8903uyqos=; 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=HIGqZRMjYPEqJ6yxGXyTi1fJvKqvBBfiWNCLacMqqUSfrDIiDLRiRKVAmArfUVA/f qkOURwYZqLmmReFVVcR0RGH4Vy3mNpgdRHT50DapzuuJ2mTlO40Lt7nJRP277++jQW tLcleeZ05I4UpaoUCoWk1vdRyhOqR4iQhos7bI/S6M8TREvX1ibsFZPiFmpzxKvt4K ZAJ99mJn0pC+q6GbmnSb/5jzh4KS/RPWzcfDBFd6DYeEr6WkbdrAB+TdA+CTJ6aSe2 3QeApiLduzW8pTpb4ALjDytK7QM84rurDH8iIn4a5UwE8qt9DZeq6tRVmja3i0znl/ z3WDd/yszI3VA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 004446A07B for <u-boot-concept@u-boot.org>; Mon, 16 Mar 2026 12:31:35 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685893; bh=tjlnbcDIgN1lGpa8JCS1oAOK/uAjC98nK4yWCGqu97c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nDcxmicOmZjq5XXKeXEJZGMYauhK8Y4vAzOHbBtSTbfKXYW0T3GQ2Wu6bY2p615ty A9tKqVhfCXay0JjVhxljCUW/XZcLosF7/TMWM1ye5BUmjOf1N2DUqNJJBol7ppWWC9 EAkGM/nynvQ30U7hn4GanXTb4CdCzX6R6RNdELv2xVO0AS052bTgVUdDmg/JPnDaNk 934IhjafZ+DFIwCETzbLKNYHWb3ra9bGAZWpY+O+HXk2WHz88U+P/zNMBxGoeIIdqU 5WcuGa9CnwokWp7BgA3s0UjHgvv1gJpjwMNNgWPe84axP/DRA5Ub8P7xoz7wOq9/Zw cThSCk0C/fepg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 42B2B6A0AC; Mon, 16 Mar 2026 12:31:33 -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 5Tux16NVOBbO; Mon, 16 Mar 2026 12:31:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773685887; bh=q9kabSq7jezyMcxURkwvQY++hND2VxaOGPuEaIjvj8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2YRMXa1t1gFw0wCKFhP6/wXfZp/0P+/Zn4sPMwqJ5E2F3PiY7P9v/jeiIPFpy+eT h4tmtXqbnenXY/JW20MXr1mfchBHEABuBVupFgYcFnk21ZElYAm53VNN9vmZkdl6nM ozjoUuA91+rqQ8UPKTG7D5o+OJCry6tsgXeIaPGI4ic0gZYIdHw1QCLZoQeEG/HBQs l8EJR4YuDZzz2Z19KifUijPDFVKjmeSMWuFon55x9ixLS3Z5cK1eys+VRw+TOHQYBU VMI8BqeH2iB+Ajdi9SP2vp4X2w4Wyh1fhBJboXRkNYRwKRaHGVXgp7cXklvH4JxB8x w3arRgccFqNkg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B092A6A0A5; Mon, 16 Mar 2026 12:31:27 -0600 (MDT) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Mon, 16 Mar 2026 12:30:38 -0600 Message-ID: <20260316183050.3855921-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260316183050.3855921-1-sjg@u-boot.org> References: <20260316183050.3855921-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CTCPPCSS42YX75FBJXTL47FW3MW4WXHV X-Message-ID-Hash: CTCPPCSS42YX75FBJXTL47FW3MW4WXHV 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 15/17] test: dm: Fix memory leaks in ACPI DP tests 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/CTCPPCSS42YX75FBJXTL47FW3MW4WXHV/> 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 |
Add automatic memory-leak detection to U-Boot tests
|
|
Commit Message
Simon Glass
March 16, 2026, 6:30 p.m. UTC
From: Simon Glass <sjg@chromium.org> Fix three memory leaks in the ACPI device property tests: - free_context() does not free ctx->base, unlike the version in acpigen.c - dm_test_acpi_dp_gpio() does not call free_context() - dm_test_acpi_dp_copy() does not call free_context() Fixes: 0e5a0a00d6e4 ("acpi: Support writing Device Properties objects via _DSD") Signed-off-by: Simon Glass <sjg@chromium.org> --- test/dm/acpi_dp.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/test/dm/acpi_dp.c b/test/dm/acpi_dp.c index 038806004b5..90921329556 100644 --- a/test/dm/acpi_dp.c +++ b/test/dm/acpi_dp.c @@ -36,6 +36,7 @@ static int alloc_context(struct acpi_ctx **ctxp) static void free_context(struct acpi_ctx **ctxp) { + free((*ctxp)->base); free(*ctxp); *ctxp = NULL; } @@ -419,6 +420,8 @@ static int dm_test_acpi_dp_gpio(struct unit_test_state *uts) ut_asserteq(ZERO_OP, pptr[0x1b]); ut_asserteq(ONE_OP, pptr[0x1c]); + free_context(&ctx); + return 0; } DM_TEST(dm_test_acpi_dp_gpio, 0); @@ -486,6 +489,8 @@ static int dm_test_acpi_dp_copy(struct unit_test_state *uts) ut_asserteq(STRING_PREFIX, ptr[0x8e]); ut_asserteq_str("sunrise ohoka", (char *)(ptr + 0x8f)); + free_context(&ctx); + return 0; } DM_TEST(dm_test_acpi_dp_copy, UTF_SCAN_PDATA | UTF_SCAN_FDT);