summaryrefslogtreecommitdiff
path: root/source/fitz/draw-mesh.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2018-01-24 00:59:35 +0100
committerSebastian Rasmussen <sebras@gmail.com>2018-01-24 15:29:23 +0100
commit8fdad62ddb46f8798643e9b1a564a2af8b12411d (patch)
tree262cb4fa1d3f03ee0ff5934353e0b400d0c303df /source/fitz/draw-mesh.c
parent83d4dae44c71816c084a635550acc1a51529b881 (diff)
downloadmupdf-8fdad62ddb46f8798643e9b1a564a2af8b12411d.tar.xz
Bug 698904: Drop pixmap only once upon error when painting shades.
If fz_new_pixmap_with_bbox() threw conv would be NULL and temp would be pointing to a pixmap that would be dropped 2 times. If fz_clone_pixmap_area_with_different_seps() threw temp and conv would be pointing to the same pixmap that would be dropped 3 times.
Diffstat (limited to 'source/fitz/draw-mesh.c')
-rw-r--r--source/fitz/draw-mesh.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/source/fitz/draw-mesh.c b/source/fitz/draw-mesh.c
index 90838709..b8bf68d2 100644
--- a/source/fitz/draw-mesh.c
+++ b/source/fitz/draw-mesh.c
@@ -293,6 +293,7 @@ fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_colorspace *colorspace, cons
}
fz_drop_pixmap(ctx, temp);
temp = conv;
+ conv = NULL;
/* Now Change from our device_n colorspace into the target colorspace/spots. */
conv = fz_clone_pixmap_area_with_different_seps(ctx, temp, NULL, dest->colorspace, dest->seps, color_params, NULL);
@@ -343,22 +344,17 @@ fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_colorspace *colorspace, cons
}
}
fz_paint_pixmap_with_overprint(dest, conv, op);
- fz_drop_pixmap(ctx, conv);
}
}
fz_always(ctx)
{
- if (temp != dest)
- fz_drop_pixmap(ctx, temp);
- fz_fin_cached_color_converter(ctx, &ptd.cc);
- }
- fz_catch(ctx)
- {
if (shade->use_function)
{
- fz_drop_pixmap(ctx, conv);
fz_drop_pixmap(ctx, temp);
+ fz_drop_pixmap(ctx, conv);
}
- fz_rethrow(ctx);
+ fz_fin_cached_color_converter(ctx, &ptd.cc);
}
+ fz_catch(ctx)
+ fz_rethrow(ctx);
}