cmd/gpt: avoid NULL check before free()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 28 Apr 2020 19:40:13 +0000 (21:40 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 1 May 2020 15:34:01 +0000 (11:34 -0400)
free() checks if its argument is NULL. Do not duplicate this in the calling
code.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
cmd/gpt.c

index b94f0051cdd780197de80229a56e940c127acc6c..b8d11c167df776476a39e64137153e953b6538f8 100644 (file)
--- 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;
 }