summaryrefslogtreecommitdiffstats
path: root/libs/androidfw
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2015-05-11 15:45:36 +0100
committerNarayan Kamath <narayan@google.com>2015-05-12 10:37:18 +0000
commit5a7587fa90732c013bb9266f1bdae0a557455c15 (patch)
treed2824499cea406e62df42f717f3b2c735ea32c32 /libs/androidfw
parent227d42db5bd1bd16b6101f799052c10f4f493647 (diff)
downloadframeworks_base-5a7587fa90732c013bb9266f1bdae0a557455c15.zip
frameworks_base-5a7587fa90732c013bb9266f1bdae0a557455c15.tar.gz
frameworks_base-5a7587fa90732c013bb9266f1bdae0a557455c15.tar.bz2
Fix file descriptor leak when opening invalid archives.
I've inspected all other callers of OpenArchive and this seems to be the only broken one. The easiest way to reproduce this is by using getPackageArchiveInfo or by adding an asset path that isn't a valid APK. bug: https://code.google.com/p/android/issues/detail?id=171099 Change-Id: I41cd85d20f26ad47968e2a6f1384cc03330b558b
Diffstat (limited to 'libs/androidfw')
-rw-r--r--libs/androidfw/ZipFileRO.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
index af3d9b3..93b1d56 100644
--- a/libs/androidfw/ZipFileRO.cpp
+++ b/libs/androidfw/ZipFileRO.cpp
@@ -68,6 +68,7 @@ ZipFileRO::~ZipFileRO() {
const int32_t error = OpenArchive(zipFileName, &handle);
if (error) {
ALOGW("Error opening archive %s: %s", zipFileName, ErrorCodeString(error));
+ CloseArchive(handle);
return NULL;
}