summaryrefslogtreecommitdiff
path: root/source/xps/xps-zip.c
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2014-12-12 15:39:32 +0100
committerSimon Bünzli <zeniko@gmail.com>2014-12-12 15:39:32 +0100
commit6b5582e8206f2cdd3afeb4e32ebbe5d144334da7 (patch)
treeecbfbced1b6dca541677f341ebffa59af7129044 /source/xps/xps-zip.c
parentd7c0c0856b31be17823ae4745b2c542a9c71765f (diff)
downloadmupdf-6b5582e8206f2cdd3afeb4e32ebbe5d144334da7.tar.xz
fix memory leaks
Commit 5add23c7233c3f34fdfa6387873b1d3bdb93e1d6 and commit 2f4cdd4fd0580e3121773e89a7c6e7a9e1ffa54b introduced three memory leaks which only appear in error cases: * unzip.c leaks if a ZIP archive uses a compression method other than store or Deflate * xps-zip.c leaks if fz_open_archive_with_stream throws for broken ZIP archives * xps-zip.c leaks also if a piece of a split file is missing
Diffstat (limited to 'source/xps/xps-zip.c')
-rw-r--r--source/xps/xps-zip.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/xps/xps-zip.c b/source/xps/xps-zip.c
index e3d006ba..4f524752 100644
--- a/source/xps/xps-zip.c
+++ b/source/xps/xps-zip.c
@@ -85,6 +85,7 @@ xps_read_part(xps_document *doc, char *partname)
}
else
{
+ fz_drop_buffer(ctx, buf);
fz_throw(ctx, FZ_ERROR_GENERIC, "cannot find all pieces for part '%s'", partname);
}
}
@@ -149,10 +150,10 @@ xps_open_document_with_stream(fz_context *ctx, fz_stream *file)
doc = fz_malloc_struct(ctx, xps_document);
xps_init_document(doc);
doc->ctx = ctx;
- doc->zip = fz_open_archive_with_stream(ctx, file);
fz_try(ctx)
{
+ doc->zip = fz_open_archive_with_stream(ctx, file);
xps_read_page_list(doc);
}
fz_catch(ctx)