summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@amd.com>2025-04-10 09:38:51 +0200
committerMichal Simek <michal.simek@amd.com>2025-04-16 13:44:44 +0200
commitd23555d7ae9ad20d2249af89ad4ca1856e4c3b9e (patch)
tree131a0e7d08b2b4b0135119e9260a9bad0c6e9384
parent878d9293a06453fb2f6d31cdd4482aa5fec2e4c4 (diff)
xilinx: Free memory when variable is saved in boot_targets_setup()
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 <michal.simek@amd.com> Link: https://lore.kernel.org/r/fa10fc22193a1a23258466056b3d02f7496fccfe.1744270729.git.michal.simek@amd.com
-rw-r--r--board/amd/versal2/board.c3
-rw-r--r--board/xilinx/versal/board.c1
2 files changed, 3 insertions, 1 deletions
diff --git a/board/amd/versal2/board.c b/board/amd/versal2/board.c
index aea3bf02260..ee0dc348783 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 <michal.simek@amd.com>
*/
@@ -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 f0ac3fbadb1..9371c30ea27 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -283,6 +283,7 @@ static int boot_targets_setup(void)
env_targets ? env_targets : "");
env_set("boot_targets", new_targets);
+ free(new_targets);
}
return 0;