diff mbox series

xilinx: zynqmp: Free allocated field for target variable

Message ID 53ded7464d816d55a3d03900dc8f78c5da05e248.1627469281.git.michal.simek@xilinx.com
State Accepted
Commit f83cfaa7f24f83c816785e33e605e29e18d76d86
Delegated to: Michal Simek
Headers show
Series xilinx: zynqmp: Free allocated field for target variable | expand

Commit Message

Michal Simek July 28, 2021, 10:48 a.m. UTC
When env_set() is called there is no need to allocate memory for variable
which is already saved that's why free it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/zynqmp/zynqmp.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michal Simek Aug. 6, 2021, 7:25 a.m. UTC | #1
st 28. 7. 2021 v 12:48 odesílatel Michal Simek <michal.simek@xilinx.com> napsal:
>
> When env_set() is called there is no need to allocate memory for variable
> which is already saved that's why free it.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  board/xilinx/zynqmp/zynqmp.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index 38c910fa5bab..2cb97f42bec3 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -735,6 +735,7 @@ int board_late_init(void)
>                         env_targets ? env_targets : "");
>
>         env_set("boot_targets", new_targets);
> +       free(new_targets);
>
>         reset_reason();
>
> --
> 2.32.0
>

Applied.
M
diff mbox series

Patch

diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 38c910fa5bab..2cb97f42bec3 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -735,6 +735,7 @@  int board_late_init(void)
 			env_targets ? env_targets : "");
 
 	env_set("boot_targets", new_targets);
+	free(new_targets);
 
 	reset_reason();