Signed-off-by: Karel Zak <kzak@redhat.com>
static int dos_set_disklabel_id(struct fdisk_context *cxt, const char *str)
{
- char *str0 = str;
+ char *buf = NULL;
unsigned int id, old;
struct fdisk_dos_label *l;
int rc = 0;
l = self_label(cxt);
old = mbr_get_id(cxt->firstsector);
- if (!str)
+ if (!str) {
rc = fdisk_ask_string(cxt,
- _("Enter the new disk identifier"), &str);
+ _("Enter the new disk identifier"), &buf);
+ str = buf;
+ }
if (!rc) {
char *end = NULL;
}
}
- if (!str0)
- free(str);
+ free(buf);
if (rc)
return -EINVAL;
gpt = self_label(cxt);
if (!str) {
+ char *buf = NULL;
+
if (fdisk_ask_string(cxt,
- _("Enter new disk UUID (in 8-4-4-4-12 format)"), &str))
+ _("Enter new disk UUID (in 8-4-4-4-12 format)"), &buf))
return -EINVAL;
- rc = string_to_guid(str, &uuid);
- free(str);
+ rc = string_to_guid(buf, &uuid);
+ free(buf);
} else
rc = string_to_guid(str, &uuid);