part_efi: make sure the gpt_pte is freed
authorMark Langsdorf <mark.langsdorf@calxeda.com>
Tue, 10 Sep 2013 20:14:56 +0000 (15:14 -0500)
committerChanho Park <chanho61.park@samsung.com>
Wed, 22 Jul 2015 12:00:44 +0000 (21:00 +0900)
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.

Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
disk/part_efi.c

index 8753aea4161f4c36af79191c5a0ee7c8661fcb8f..bac9cf84ea4a7c7af41f2317262fc6d4c116458c 100644 (file)
@@ -180,8 +180,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;
        }