Skip to contentSkip to conversation

part_efi: make sure the gpt_pte is freed

PATCH New Mark Langsdorf 2 participants 2 messages Sep 10, 2013 – Sep 21, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 part_efi: make sure the gpt_pte is freed

the gpt_pte wasn't being freed if it was checked against an invalid partition. The resulting memory leakage could make it impossible to repeatedly attempt to load non-existent files in a script.

Also, downgrade the message for not finding an invalid partition from a printf() to a debug() so as to minimize message spam in perfectly normal situations.

---
 disk/part_efi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
disk/part_efi.c +2 -1
index b7524d6..9c33ae7 100644
@@ -164,8 +164,9 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
 
 	if (part > le32_to_cpu(gpt_head->num_partition_entries) ||
 	    !is_pte_valid(&gpt_pte[part - 1])) {
-		printf("%s: *** ERROR: Invalid partition number %d ***\n",
+		debug("%s: *** ERROR: Invalid partition number %d ***\n",
 			__func__, part);
+		free(gpt_pte);
 		return -1;
 	}
 
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/6 part_efi: make sure the gpt_pte is freed

Quoted 9 lines · Mark Langsdorf

the gpt_pte wasn't being freed if it was checked against an invalid partition. The resulting memory leakage could make it impossible to repeatedly attempt to load non-existent files in a script.

Also, downgrade the message for not finding an invalid partition from a printf() to a debug() so as to minimize message spam in perfectly normal situations.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130921/1d6316d2/attachment.pgp>