Skip to contentSkip to conversation

cmd/gpt: avoid NULL check before free()

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

lore
Share & tools
lore
#0 lore raw

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

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

---
 cmd/gpt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
cmd/gpt.c +2 -4
index efaf1bcecb..fb58e4fdc7 100644
@@ -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

#1 lore raw

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

Quoted 4 lines · Heinrich Schuchardt

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

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/20200429/4f464d87/attachment.sig>
#2 lore raw

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

In reply to Heinrich Schuchardt
Quoted 5 lines · Heinrich Schuchardt

free() checks if its argument is NULL. Do not 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/0af35b81/attachment.sig>