dissect-image: simplify things by avoiding one string copy
We don't need the node in its original variable anymore, hence let's just move it over instead of allocating a copy.
This commit is contained in:
@@ -862,9 +862,7 @@ static int dissect_image(
|
||||
generic_rw = !(pflags & SD_GPT_FLAG_READ_ONLY);
|
||||
generic_growfs = FLAGS_SET(pflags, SD_GPT_FLAG_GROWFS);
|
||||
generic_uuid = id;
|
||||
generic_node = strdup(node);
|
||||
if (!generic_node)
|
||||
return -ENOMEM;
|
||||
generic_node = TAKE_PTR(node);
|
||||
}
|
||||
|
||||
} else if (type.designator == PARTITION_VAR) {
|
||||
@@ -982,9 +980,7 @@ static int dissect_image(
|
||||
generic_nr = nr;
|
||||
generic_rw = true;
|
||||
generic_growfs = false;
|
||||
generic_node = strdup(node);
|
||||
if (!generic_node)
|
||||
return -ENOMEM;
|
||||
generic_node = TAKE_PTR(node);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user