cmd: gpt: remove bogus code leftover from merge conflict resolution
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 9 May 2019 13:55:14 +0000 (15:55 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 9 May 2019 13:55:14 +0000 (15:55 +0200)
and fix leaking memory for str_disk_guid in case of error.

common/cmd_gpt.c

index 1feb41d..f401209 100644 (file)
@@ -141,7 +141,6 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
        char *val, *p;
        int p_count;
        disk_partition_t *parts;
-       char *guid_str;
        int errno = 0;
        uint64_t size_ll, start_ll;
 
@@ -259,7 +258,6 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
                }
        }
 
-       *str_disk_guid = guid_str;
        *parts_count = p_count;
        *partitions = parts;
        free(str);
@@ -267,10 +265,8 @@ static int set_gpt_info(block_dev_desc_t *dev_desc,
        return 0;
 
 err:
+       free(*str_disk_guid);
        free(parts);
-free_guid:
-       free(guid_str);
-free_str:
        free(str);
 
        *str_disk_guid = NULL;