summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2012-08-05 16:01:04 +0200
committerSebastian Rasmussen <sebras@gmail.com>2012-08-06 14:07:21 +0200
commit7170e67ed5636f2eaf74ea723e29b3d8c2b06467 (patch)
tree50a80312a6bad8fe0a326febc0e3f1959c279551
parent63777c8847eedd973ca4e62a1a3cd1179dd9e63e (diff)
downloadmupdf-7170e67ed5636f2eaf74ea723e29b3d8c2b06467.tar.xz
Free jpeg state upon decoding error, even if not fully inited
Previously the jpeg decoder state had to be fully initialized in order to be freed when the jpeg decoder is closed, e.g. due to an error. Now, signal that the decode state is initialized earlier, even if the state has not been fully initialized, so that the state is freed.
-rw-r--r--fitz/filt_dctd.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fitz/filt_dctd.c b/fitz/filt_dctd.c
index 1b588d2a..76f82abe 100644
--- a/fitz/filt_dctd.c
+++ b/fitz/filt_dctd.c
@@ -107,6 +107,7 @@ read_dctd(fz_stream *stm, unsigned char *buf, int len)
jpeg_std_error(cinfo->err);
cinfo->err->error_exit = error_exit;
jpeg_create_decompress(cinfo);
+ state->init = 1;
/* Skip over any stray returns at the start of the stream */
while ((c = fz_peek_byte(state->chain)) == '\n' || c == '\r')
@@ -165,8 +166,6 @@ read_dctd(fz_stream *stm, unsigned char *buf, int len)
state->scanline = fz_malloc(state->ctx, state->stride);
state->rp = state->scanline;
state->wp = state->scanline;
-
- state->init = 1;
}
while (state->rp < state->wp && p < ep)