diff options
author | Piotr Jastrzebski <haaawk@google.com> | 2014-08-08 14:02:17 +0100 |
---|---|---|
committer | Piotr Jastrzebski <haaawk@google.com> | 2014-08-11 07:58:00 +0100 |
commit | 79c8b34f36ef29d481e76ebd8af97992c894d58c (patch) | |
tree | f17eaaca7f4929257257ce058b08562bc9f021a9 /libziparchive | |
parent | 2f40ddf3f3e4ce88681311fc0e2321e2c54cd413 (diff) | |
download | core-79c8b34f36ef29d481e76ebd8af97992c894d58c.tar.gz core-79c8b34f36ef29d481e76ebd8af97992c894d58c.tar.bz2 core-79c8b34f36ef29d481e76ebd8af97992c894d58c.zip |
Add EndIteration method to free memory allocated
in StartIteration. This method should always be called when the
iteration is over to make sure that we don't leak memory.
Change-Id: I5205c754dfafbab9bb5f06003c3663d2ec4e8a35
Diffstat (limited to 'libziparchive')
-rw-r--r-- | libziparchive/zip_archive.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc index 6ec8f0d34..366fb243f 100644 --- a/libziparchive/zip_archive.cc +++ b/libziparchive/zip_archive.cc @@ -909,6 +909,12 @@ int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, const char* p return 0; } +void EndIteration(void* cookie) { + if (cookie != NULL) { + free(cookie); + } +} + int32_t FindEntry(const ZipArchiveHandle handle, const char* entryName, ZipEntry* data) { const ZipArchive* archive = (ZipArchive*) handle; |