summaryrefslogtreecommitdiff
path: root/source/gprf
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-03-28 15:17:27 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-04-03 21:21:44 +0200
commitef3cfb2a49b5be82d56d783f505319754dc65cb8 (patch)
treef299436312d6230c08289b61e9bad51a4dd31681 /source/gprf
parentd9f0fdfe1ac986816a3376ee0271f84fb549b0bf (diff)
downloadmupdf-ef3cfb2a49b5be82d56d783f505319754dc65cb8.tar.xz
Don't implicitly drop in fz_open_* chained filters.
Diffstat (limited to 'source/gprf')
-rw-r--r--source/gprf/gprf-doc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c
index 2c508139..44e12ebc 100644
--- a/source/gprf/gprf-doc.c
+++ b/source/gprf/gprf-doc.c
@@ -353,8 +353,9 @@ gprf_get_pixmap(fz_context *ctx, fz_image *image_, fz_irect *area, int w, int h,
unsigned char equiv[3 + FZ_MAX_SEPARATIONS][4];
int bytes_per_channel = image->super.w * image->super.h;
unsigned char *out = fz_pixmap_samples(ctx, pix);
+ fz_stream *tmp_file = NULL;
- fz_var(file);
+ fz_var(tmp_file);
if (area)
{
@@ -404,9 +405,11 @@ gprf_get_pixmap(fz_context *ctx, fz_image *image_, fz_irect *area, int w, int h,
read_sep[i] = 2;
memset(&data[i * decode_chunk_size], 0, decode_chunk_size);
}
- file[i] = fz_open_file(ctx, image->file->filename);
- fz_seek(ctx, file[i], image->offset[i], SEEK_SET);
- file[i] = fz_open_flated(ctx, file[i], 15);
+ tmp_file = fz_open_file(ctx, image->file->filename);
+ fz_seek(ctx, tmp_file, image->offset[i], SEEK_SET);
+ file[i] = fz_open_flated(ctx, tmp_file, 15);
+ fz_drop_stream(ctx, tmp_file);
+ tmp_file = NULL;
}
/* Now actually do the decode */
@@ -463,6 +466,7 @@ gprf_get_pixmap(fz_context *ctx, fz_image *image_, fz_irect *area, int w, int h,
}
fz_always(ctx)
{
+ fz_drop_stream(ctx, tmp_file);
for (i = 0; i < 3+num_seps; i++)
fz_drop_stream(ctx, file[i]);
}