mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 20:47:44 +00:00
bug 709330 - AboutHomeContent.getRecommendedAddonsStream() resource leak because ZipFile was not closed r=mfinkle
This commit is contained in:
parent
35fbd86079
commit
5e5c6bb313
@ -236,13 +236,19 @@ public class AboutHomeContent extends ScrollView {
|
||||
if (is != null)
|
||||
return is;
|
||||
File applicationPackage = new File(activity.getApplication().getPackageResourcePath());
|
||||
ZipFile zip = new ZipFile(applicationPackage);
|
||||
if (zip == null)
|
||||
return null;
|
||||
ZipEntry fileEntry = zip.getEntry("recommended-addons.json");
|
||||
if (fileEntry == null)
|
||||
return null;
|
||||
return zip.getInputStream(fileEntry);
|
||||
ZipFile zip = null;
|
||||
try {
|
||||
zip = new ZipFile(applicationPackage);
|
||||
if (zip == null)
|
||||
return null;
|
||||
ZipEntry fileEntry = zip.getEntry("recommended-addons.json");
|
||||
if (fileEntry == null)
|
||||
return null;
|
||||
return zip.getInputStream(fileEntry);
|
||||
} finally {
|
||||
if (zip != null)
|
||||
zip.close();
|
||||
}
|
||||
}
|
||||
|
||||
void readRecommendedAddons(final Activity activity) {
|
||||
|
Loading…
Reference in New Issue
Block a user