From: Heinrich Schuchardt <xypron.glpk@gmx.de>
Date: Tue, 28 Apr 2020 19:56:10 +0000 (+0200)
Subject: hush: avoid NULL check before free()
X-Git-Tag: v2025.01-rc5-pxa1908~2435^2~8
X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=f4070e6f6c680034d67f13b878f0da55b3b51f92;p=u-boot.git

hush: avoid NULL check before free()

free() checks if its argument is NULL. Don't duplicate this in the calling
code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

diff --git a/common/cli_hush.c b/common/cli_hush.c
index cf1e273485..a62af07cc5 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -1849,8 +1849,7 @@ static int run_list_real(struct pipe *pi)
 				continue;
 			} else {
 				/* insert new value from list for variable */
-				if (pi->progs->argv[0])
-					free(pi->progs->argv[0]);
+				free(pi->progs->argv[0]);
 				pi->progs->argv[0] = *list++;
 #ifndef __U_BOOT__
 				pi->progs->glob_result.gl_pathv[0] =