From patchwork Tue Apr 28 19:56:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 238777 List-Id: U-Boot discussion From: xypron.glpk at gmx.de (Heinrich Schuchardt) Date: Tue, 28 Apr 2020 21:56:10 +0200 Subject: [PATCH 1/1] hush: avoid NULL check before free() Message-ID: <20200428195610.16002-1-xypron.glpk@gmx.de> free() checks if its argument is NULL. Don't duplicate this in the calling code. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- common/cli_hush.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.26.2 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] =