When boot_targets variable is saved there is no reason to keep string in malloc area that's why free it. This change is already done in ZynqMP code.
Signed-off-by: Michal Simek <[email protected]> --- board/amd/versal2/board.c | 3 ++- board/xilinx/versal/board.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/board/amd/versal2/board.c b/board/amd/versal2/board.c index aea3bf022600..ee0dc3487831 100644 --- a/board/amd/versal2/board.c +++ b/board/amd/versal2/board.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2021 - 2022, Xilinx, Inc. - * Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc. + * Copyright (C) 2022 - 2025, Advanced Micro Devices, Inc. * * Michal Simek <[email protected]> */ @@ -307,6 +307,7 @@ static int boot_targets_setup(void) env_targets ? env_targets : ""); env_set("boot_targets", new_targets); + free(new_targets); } return 0; diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 6c4a2f5ead62..de53657b0c4e 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -282,6 +282,7 @@ static int boot_targets_setup(void) env_targets ? env_targets : ""); env_set("boot_targets", new_targets); + free(new_targets); } return 0; -- 2.43.0

