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,
|
||||
encryptedVolume: EncryptedVolume,
|
||||
): Boolean {
|
||||
val fd = exportedFile.open(ParcelFileDescriptor.MODE_WRITE_ONLY, false).fileDescriptor
|
||||
return encryptedVolume.exportFile(exportedFile.path, FileOutputStream(fd))
|
||||
val pfd = exportedFile.open(ParcelFileDescriptor.MODE_WRITE_ONLY, false)
|
||||
return encryptedVolume.exportFile(exportedFile.path, FileOutputStream(pfd.fileDescriptor)).also {
|
||||
pfd.close()
|
||||
}
|
||||
}
|
||||
|
||||
enum class Error {
|
||||
|
Loading…
Reference in New Issue
Block a user