mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 19:36:08 +03:00
Merge pull request #414 from Dominaezzz/kt-leak
Fix potential resource leak
This commit is contained in:
commit
c2e053b62b
1 changed files with 2 additions and 5 deletions
|
@ -26,11 +26,8 @@ import java.io.InputStream
|
|||
*/
|
||||
@WorkerThread
|
||||
fun writeToFile(inputStream: InputStream, outputFile: File) {
|
||||
val source = Okio.buffer(Okio.source(inputStream))
|
||||
val sink = Okio.buffer(Okio.sink(outputFile))
|
||||
|
||||
source.use { input ->
|
||||
sink.use { output ->
|
||||
Okio.buffer(Okio.source(inputStream)).use { input ->
|
||||
Okio.buffer(Okio.sink(outputFile)).use { output ->
|
||||
output.writeAll(input)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue