summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-03-04 17:39:38 -0800
committerMathieu Chartier <mathieuc@google.com>2014-03-04 17:44:58 -0800
commit5f98b12640af0fd937c1cd5929248f8f01779922 (patch)
treecd3084c10e26e6ea34da24cd9f94d4a835523253
parent2a16a5847a2811626a108f8cbd7606680647df86 (diff)
downloadsystem_core-5f98b12640af0fd937c1cd5929248f8f01779922.zip
system_core-5f98b12640af0fd937c1cd5929248f8f01779922.tar.gz
system_core-5f98b12640af0fd937c1cd5929248f8f01779922.tar.bz2
Add free to CloseArchive.
Currently CloseArchive doesn't call free and call sites don't appear to either. I could not find any call sites which manually freed the archive by deleting the handle. This fixes several memory leaks. Change-Id: I21f187dde60fd87e6e54bde06de9e76fd0791104
-rw-r--r--libziparchive/zip_archive.cc8
1 files changed, 1 insertions, 7 deletions
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index 8ef0962..01f9249 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -591,13 +591,7 @@ void CloseArchive(ZipArchiveHandle handle) {
archive->directory_map->release();
}
free(archive->hash_table);
-
- /* ensure nobody tries to use the ZipArchive after it's closed */
- archive->directory_offset = -1;
- archive->fd = -1;
- archive->num_entries = -1;
- archive->hash_table_size = -1;
- archive->hash_table = NULL;
+ free(archive);
}
static int32_t UpdateEntryFromDataDescriptor(int fd,