Close open FD after file export to avoid resource leaks
This commit is contained in:
parent
88bd746359
commit
b477272d65
@ -160,8 +160,10 @@ class EncryptedFileProvider(context: Context) {
|
|||||||
exportedFile: ExportedFile,
|
exportedFile: ExportedFile,
|
||||||
encryptedVolume: EncryptedVolume,
|
encryptedVolume: EncryptedVolume,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val fd = exportedFile.open(ParcelFileDescriptor.MODE_WRITE_ONLY, false).fileDescriptor
|
val pfd = exportedFile.open(ParcelFileDescriptor.MODE_WRITE_ONLY, false)
|
||||||
return encryptedVolume.exportFile(exportedFile.path, FileOutputStream(fd))
|
return encryptedVolume.exportFile(exportedFile.path, FileOutputStream(pfd.fileDescriptor)).also {
|
||||||
|
pfd.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class Error {
|
enum class Error {
|
||||||
|
Loading…
Reference in New Issue
Block a user