[incfs] Fix a leaked pending_reads FD
Bug: 153670585 Test: adb install/uninstall a dozen times Change-Id: Iac05b5dc3792e55c2f103ac08bdd734b3b398882
This commit is contained in:
committed by
Alex Buynytskyy
parent
6c6d81a121
commit
4e21986e59
@@ -34,6 +34,8 @@ import android.os.ParcelFileDescriptor;
|
||||
import android.util.ExceptionUtils;
|
||||
import android.util.Slog;
|
||||
|
||||
import libcore.io.IoUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -115,22 +117,10 @@ public abstract class DataLoaderService extends Service {
|
||||
destroy(id);
|
||||
throw new RuntimeException(ex);
|
||||
} finally {
|
||||
// Closing FDs.
|
||||
if (control.incremental != null) {
|
||||
if (control.incremental.cmd != null) {
|
||||
try {
|
||||
control.incremental.cmd.close();
|
||||
} catch (IOException e) {
|
||||
Slog.e(TAG, "Failed to close IncFs CMD file descriptor " + e);
|
||||
}
|
||||
}
|
||||
if (control.incremental.log != null) {
|
||||
try {
|
||||
control.incremental.log.close();
|
||||
} catch (IOException e) {
|
||||
Slog.e(TAG, "Failed to close IncFs LOG file descriptor " + e);
|
||||
}
|
||||
}
|
||||
IoUtils.closeQuietly(control.incremental.cmd);
|
||||
IoUtils.closeQuietly(control.incremental.pendingReads);
|
||||
IoUtils.closeQuietly(control.incremental.log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user