am b90b9d54: am 6be23712: Merge "Free created FileMap when uncompressing files" into gingerbread

Merge commit 'b90b9d54eb6bbc3a4045ff0bf46d3366822e835e'

* commit 'b90b9d54eb6bbc3a4045ff0bf46d3366822e835e':
  Free created FileMap when uncompressing files
This commit is contained in:
Kenny Root 2010-08-24 09:02:28 -07:00 committed by Android Git Automerger
commit 8d7fcccef6

View File

@ -636,7 +636,7 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const
memcpy(buffer, ptr, uncompLen);
} else {
if (!inflateBuffer(buffer, ptr, uncompLen, compLen))
goto bail;
goto unmap;
}
if (compLen > kSequentialMin)
@ -644,6 +644,8 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const
result = true;
unmap:
file->release();
bail:
return result;
}
@ -667,7 +669,7 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const
getEntryInfo(entry, &method, &uncompLen, &compLen, &offset, NULL, NULL);
const FileMap* file = createEntryFileMap(entry);
FileMap* file = createEntryFileMap(entry);
if (file == NULL) {
goto bail;
}
@ -678,21 +680,23 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const
ssize_t actual = write(fd, ptr, uncompLen);
if (actual < 0) {
LOGE("Write failed: %s\n", strerror(errno));
goto bail;
goto unmap;
} else if ((size_t) actual != uncompLen) {
LOGE("Partial write during uncompress (%zd of %zd)\n",
(size_t)actual, (size_t)uncompLen);
goto bail;
goto unmap;
} else {
LOGI("+++ successful write\n");
}
} else {
if (!inflateBuffer(fd, ptr, uncompLen, compLen))
goto bail;
goto unmap;
}
result = true;
unmap:
file->release();
bail:
return result;
}