fix rest of resource leaks (#1351)

This commit is contained in:
Vincent Breitmoser
2015-06-17 21:30:25 +02:00
parent 5895385153
commit f5aa36ef9f
7 changed files with 79 additions and 65 deletions

View File

@@ -391,10 +391,15 @@ public class KeychainDatabase extends SQLiteOpenHelper {
private static void copy(File in, File out) throws IOException {
FileInputStream is = new FileInputStream(in);
FileOutputStream os = new FileOutputStream(out);
byte[] buf = new byte[512];
while (is.available() > 0) {
int count = is.read(buf, 0, 512);
os.write(buf, 0, count);
try {
byte[] buf = new byte[512];
while (is.available() > 0) {
int count = is.read(buf, 0, 512);
os.write(buf, 0, count);
}
} finally {
is.close();
os.close();
}
}