Skip to contentSkip to conversation

hush: avoid NULL check before free()

PATCH New Heinrich Schuchardt 3 participants 3 messages Apr 28, 2020 – May 1, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hush: avoid NULL check before free()

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

---
 common/cli_hush.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
common/cli_hush.c +1 -2
index cf1e273485..a62af07cc5 100644
@@ -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] =

--
2.26.2

#2 lore raw

PATCH 1/1 hush: avoid NULL check before free()

In reply to Heinrich Schuchardt
Quoted 5 lines · Heinrich Schuchardt

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

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200501/e00be0ba/attachment.sig>