Avoid leaking AssetFileDescriptor.

Change-Id: Iac388c8aefc684980cb4c7131fb47319f6073eb3
main
Jeff Sharkey 2013-04-29 12:26:33 -07:00
parent 2df8e1033b
commit c5ebc792d6
1 changed files with 10 additions and 2 deletions

View File

@ -95,8 +95,16 @@ final class BinaryDictionaryGetter {
+ fallbackResId);
return null;
}
return AssetFileAddress.makeFromFileNameAndOffset(
context.getApplicationInfo().sourceDir, afd.getStartOffset(), afd.getLength());
try {
return AssetFileAddress.makeFromFileNameAndOffset(
context.getApplicationInfo().sourceDir, afd.getStartOffset(), afd.getLength());
} finally {
try {
afd.close();
} catch (IOException e) {
// Ignored
}
}
}
private static final class DictPackSettings {