[lptools] partition was freed, thus name was zero-ed, leading to a partition with an empty name rather than expected dst name
This commit is contained in:
parent
00d5b05ee9
commit
d9140dbd8d
@ -194,6 +194,10 @@ int main(int argc, char **argv) {
|
||||
if(dstPartition == nullptr) {
|
||||
dstPartition = builder->FindPartition(dst + ::android::base::GetProperty("ro.boot.slot_suffix", ""));
|
||||
}
|
||||
std::string dstPartitionName = dst;
|
||||
if(dstPartition != nullptr) {
|
||||
dstPartitionName = dstPartition->name();
|
||||
}
|
||||
std::vector<std::unique_ptr<Extent>> originalExtents;
|
||||
|
||||
const auto& extents = srcPartition->extents();
|
||||
@ -209,8 +213,8 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
builder->RemovePartition(srcPartition->name());
|
||||
builder->RemovePartition(dstPartition->name());
|
||||
auto newDstPartition = builder->AddPartition(dstPartition->name(), group, 0);
|
||||
builder->RemovePartition(dstPartitionName);
|
||||
auto newDstPartition = builder->AddPartition(dstPartitionName, group, 0);
|
||||
for(auto&& extent: originalExtents) {
|
||||
newDstPartition->AddExtent(std::move(extent));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user