Clear BCB if space allocation failed

setupBcb() is called before allocating space, if space allocation
failed, we should clearBcb() to properly release resources.

Test: th
Bug: 221001516
Change-Id: Idce67925503cf910ab226b193a4387c32225c0bb
This commit is contained in:
Kelvin Zhang
2022-02-23 08:49:09 -08:00
parent fef5a2b0d0
commit c256798220

View File

@@ -674,10 +674,12 @@ public class RecoverySystem {
}
try {
if (!rs.allocateSpaceForUpdate(packageFile)) {
rs.clearBcb();
throw new IOException("Failed to allocate space for update "
+ packageFile.getAbsolutePath());
}
} catch (RemoteException e) {
rs.clearBcb();
e.rethrowAsRuntimeException();
}