summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-03-18 13:16:38 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-03-21 12:57:04 +0100
commit4ce90ae4dcfabb6ddf19777165f585b24691876b (patch)
tree0d4b57373f2c96b8901979b1e9e946681c7c5c6f
parented88b522e3f3b4a70cd65173479b2408935ef990 (diff)
downloadmupdf-4ce90ae4dcfabb6ddf19777165f585b24691876b.tar.xz
Fix error handling in fz_save_pixmap_as_pam.
-rw-r--r--source/fitz/pixmap.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c
index a7d26b17..2b72cd00 100644
--- a/source/fitz/pixmap.c
+++ b/source/fitz/pixmap.c
@@ -725,9 +725,15 @@ void
fz_save_pixmap_as_pam(fz_context *ctx, fz_pixmap *pixmap, char *filename, int savealpha)
{
fz_output *out = fz_new_output_with_path(ctx, filename, 0);
- fz_write_pam_header(ctx, out, pixmap->w, pixmap->h, pixmap->n, savealpha);
- fz_write_pam_band(ctx, out, pixmap->w, pixmap->h, pixmap->n, 0, pixmap->h, pixmap->samples, savealpha);
- fz_drop_output(ctx, out);
+ fz_try(ctx)
+ {
+ fz_write_pam_header(ctx, out, pixmap->w, pixmap->h, pixmap->n, savealpha);
+ fz_write_pam_band(ctx, out, pixmap->w, pixmap->h, pixmap->n, 0, pixmap->h, pixmap->samples, savealpha);
+ }
+ fz_always(ctx)
+ fz_drop_output(ctx, out);
+ fz_catch(ctx)
+ fz_rethrow(ctx);
}
/*