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:
Lennart Poettering
2022-12-23 12:42:37 +01:00
parent 583dc6d933
commit a559088671
+2 -6
View File
@@ -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;