[PATCH 1/1] cmd/gpt: avoid NULL check before free()

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Apr 28 21:40:13 CEST 2020


free() checks if its argument is NULL. Do not duplicate this in the calling
code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 cmd/gpt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index efaf1bcecb..fb58e4fdc7 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -772,11 +772,9 @@ static int do_rename_gpt_parts(struct blk_desc *dev_desc, char *subcomm,
  out:
 	del_gpt_info();
 #ifdef CONFIG_RANDOM_UUID
-	if (str_disk_guid)
-		free(str_disk_guid);
+	free(str_disk_guid);
 #endif
-	if (new_partitions)
-		free(new_partitions);
+	free(new_partitions);
 	free(partitions_list);
 	return ret;
 }
--
2.26.2



More information about the U-Boot mailing list