mirror of
https://github.com/revanced/smali.git
synced 2025-05-08 02:14:32 +02:00
Ensure the ZipFile is closed in isZipFile() of ZipDexContainer
When calling isZipFile() in ZipDexContainer, the ZipFile would remain open if the file was in fact a zip file but the ZipFile object would then go out of scope thus creating a resource leak. This ensures that the ZipFile is closed by adding a finally clause containing a close call at the end of the try catch block.
This commit is contained in:
parent
5189797292
commit
e75f2b230a
@ -123,13 +123,22 @@ public class ZipDexContainer implements MultiDexContainer<ZipDexFile> {
|
||||
}
|
||||
|
||||
public boolean isZipFile() {
|
||||
ZipFile zipFile = null;
|
||||
try {
|
||||
getZipFile();
|
||||
zipFile = getZipFile();
|
||||
return true;
|
||||
} catch (IOException ex) {
|
||||
return false;
|
||||
} catch (NotAZipFileException ex) {
|
||||
return false;
|
||||
} finally {
|
||||
if(zipFile != null) {
|
||||
try {
|
||||
zipFile.close();
|
||||
} catch (IOException ex) {
|
||||
// just eat it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user