summaryrefslogtreecommitdiff
path: root/source/fitz/unzip.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-10-11 20:39:11 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-11-22 23:09:51 +0100
commit65996a1ffa6937ae5fa1825ef9cac09927163c1c (patch)
tree87f6c3cd3ef8b7cfd2fd8737a513ddba45538410 /source/fitz/unzip.c
parent46fe810563b4ca04b9804fd1163d22ca76cfa4ac (diff)
downloadmupdf-65996a1ffa6937ae5fa1825ef9cac09927163c1c.tar.xz
Use custom allocator everywhere zlib is used.
Diffstat (limited to 'source/fitz/unzip.c')
-rw-r--r--source/fitz/unzip.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/fitz/unzip.c b/source/fitz/unzip.c
index c5798fa8..4eb90dda 100644
--- a/source/fitz/unzip.c
+++ b/source/fitz/unzip.c
@@ -37,6 +37,16 @@ struct fz_zip_archive_s
zip_entry *entries;
};
+static void *zalloc_zip(void *opaque, unsigned int items, unsigned int size)
+{
+ return fz_malloc_array_no_throw(opaque, items, size);
+}
+
+static void zfree_zip(void *opaque, void *address)
+{
+ fz_free(opaque, address);
+}
+
static void drop_zip_archive(fz_context *ctx, fz_archive *arch)
{
fz_zip_archive *zip = (fz_zip_archive *) arch;
@@ -323,8 +333,8 @@ static fz_buffer *read_zip_entry(fz_context *ctx, fz_archive *arch, const char *
{
fz_read(ctx, file, cbuf, ent->csize);
- z.zalloc = (alloc_func) fz_malloc_array;
- z.zfree = (free_func) fz_free;
+ z.zalloc = zalloc_zip;
+ z.zfree = zfree_zip;
z.opaque = ctx;
z.next_in = cbuf;
z.avail_in = ent->csize;