hush: avoid NULL check before free()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 28 Apr 2020 19:56:10 +0000 (21:56 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 1 May 2020 15:34:01 +0000 (11:34 -0400)
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>
common/cli_hush.c

index cf1e273485c7e98c82cc897030439faf3a2e917e..a62af07cc5469c080bac40b9d711373a9d4b35a6 100644 (file)
@@ -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] =