diff options
author | Kenny Root <kroot@google.com> | 2010-08-04 16:30:40 -0700 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2010-08-04 16:53:56 -0700 |
commit | 8f20e5e540e9d2be8db31e2a9d8eb04a5621b494 (patch) | |
tree | af4a96bbc5821c673a67c7b52ee486dc893af93a /libs/utils | |
parent | 996ad778a269ea84b429021979d9134b0991536b (diff) | |
download | frameworks_native-8f20e5e540e9d2be8db31e2a9d8eb04a5621b494.zip frameworks_native-8f20e5e540e9d2be8db31e2a9d8eb04a5621b494.tar.gz frameworks_native-8f20e5e540e9d2be8db31e2a9d8eb04a5621b494.tar.bz2 |
Free scanBuf in ZipFileRO
In the success case, the 65kB scanBuf was not freed!
Also, get rid of annoying complaints about ssize_t from printf in error
cases.
Change-Id: If154ac19bf47637f898b4ec8c8e27c9a073a7b81
Diffstat (limited to 'libs/utils')
-rw-r--r-- | libs/utils/ZipFileRO.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp index 28dc512..a4c3500 100644 --- a/libs/utils/ZipFileRO.cpp +++ b/libs/utils/ZipFileRO.cpp @@ -253,21 +253,21 @@ bool ZipFileRO::mapCentralDirectory(void) /* * Grab the CD offset and size, and the number of entries in the - * archive. Verify that they look reasonable. + * archive. After that, we can release our EOCD hunt buffer. */ unsigned int numEntries = get2LE(eocdPtr + kEOCDNumEntries); unsigned int dirSize = get4LE(eocdPtr + kEOCDSize); unsigned int dirOffset = get4LE(eocdPtr + kEOCDFileOffset); + free(scanBuf); + // Verify that they look reasonable. if ((long long) dirOffset + (long long) dirSize > (long long) eocdOffset) { LOGW("bad offsets (dir %ld, size %u, eocd %ld)\n", (long) dirOffset, dirSize, (long) eocdOffset); - free(scanBuf); return false; } if (numEntries == 0) { LOGW("empty archive?\n"); - free(scanBuf); return false; } @@ -277,14 +277,12 @@ bool ZipFileRO::mapCentralDirectory(void) mDirectoryMap = new FileMap(); if (mDirectoryMap == NULL) { LOGW("Unable to create directory map: %s", strerror(errno)); - free(scanBuf); return false; } if (!mDirectoryMap->create(mFileName, mFd, dirOffset, dirSize, true)) { LOGW("Unable to map '%s' (%zd to %zd): %s\n", mFileName, dirOffset, dirOffset + dirSize, strerror(errno)); - free(scanBuf); return false; } @@ -683,7 +681,7 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const goto bail; } else if ((size_t) actual != uncompLen) { LOGE("Partial write during uncompress (%zd of %zd)\n", - actual, uncompLen); + (size_t)actual, (size_t)uncompLen); goto bail; } else { LOGI("+++ successful write\n"); |