summaryrefslogtreecommitdiff
path: root/source/fitz/load-tiff.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/fitz/load-tiff.c')
-rw-r--r--source/fitz/load-tiff.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c
index 2da9e635..3dad8a82 100644
--- a/source/fitz/load-tiff.c
+++ b/source/fitz/load-tiff.c
@@ -309,12 +309,12 @@ tiff_decode_data(fz_context *ctx, struct tiff *tiff, const unsigned char *rp, un
rp = reversed;
}
+ fz_var(jpegtables);
fz_var(encstm);
fz_var(stm);
fz_try(ctx)
{
- /* each decoder will close this */
encstm = fz_open_memory(ctx, rp, rlen);
/* switch on compression to create a filter */
@@ -331,7 +331,7 @@ tiff_decode_data(fz_context *ctx, struct tiff *tiff, const unsigned char *rp, un
{
case 1:
/* stm already open and reading uncompressed data */
- stm = encstm;
+ stm = fz_keep_stream(ctx, encstm);
break;
case 2:
case 3:
@@ -385,7 +385,6 @@ tiff_decode_data(fz_context *ctx, struct tiff *tiff, const unsigned char *rp, un
stm = fz_open_thunder(ctx, encstm, tiff->imagewidth);
break;
default:
- stm = encstm;
fz_throw(ctx, FZ_ERROR_GENERIC, "unknown TIFF compression: %d", tiff->compression);
}
@@ -393,6 +392,8 @@ tiff_decode_data(fz_context *ctx, struct tiff *tiff, const unsigned char *rp, un
}
fz_always(ctx)
{
+ fz_drop_stream(ctx, jpegtables);
+ fz_drop_stream(ctx, encstm);
fz_drop_stream(ctx, stm);
fz_free(ctx, reversed);
}