summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2018-09-06 04:07:54 +0800
committerSebastian Rasmussen <sebras@gmail.com>2018-09-06 20:35:20 +0800
commit605d8a1b2760845b772ce47c5d65a871281f58de (patch)
treef3b7c9961a27894a88e0f788ef0e90c586e106f2
parent7864e91674d70cdb5c3d6cea04abf5f183cae794 (diff)
downloadmupdf-605d8a1b2760845b772ce47c5d65a871281f58de.tar.xz
Bug 699723: Free alternative colorspace upon error when loading ICC colorspace.
-rw-r--r--source/pdf/pdf-colorspace.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/pdf/pdf-colorspace.c b/source/pdf/pdf-colorspace.c
index d112baa7..49f2354b 100644
--- a/source/pdf/pdf-colorspace.c
+++ b/source/pdf/pdf-colorspace.c
@@ -71,14 +71,17 @@ load_icc_based(fz_context *ctx, pdf_obj *dict, int alt)
fz_drop_buffer(ctx, buffer);
fz_catch(ctx)
{
- if (!alt)
+ if (!alt) {
+ fz_drop_colorspace(ctx, cs_alt);
fz_rethrow(ctx);
+ }
}
if (cs)
{
if (n != 1 && n != 3 && n != 4)
{
+ fz_drop_colorspace(ctx, cs_alt);
fz_drop_colorspace(ctx, cs);
fz_throw(ctx, FZ_ERROR_GENERIC, "ICC Based must have 1, 3 or 4 components");
}
@@ -94,7 +97,10 @@ load_icc_based(fz_context *ctx, pdf_obj *dict, int alt)
* or because we aren't in an ICC workflow. If we aren't allowed
* to return the alternate, then that's all she wrote. */
if (!alt)
+ {
+ fz_drop_colorspace(ctx, cs_alt);
fz_throw(ctx, FZ_ERROR_GENERIC, "Unable to read ICC workflow");
+ }
/* If we have an alternate we are allowed to use, return that. */
if (cs_alt)