summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-xref.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-04-11 18:00:39 +0100
committerRobin Watts <robin.watts@artifex.com>2016-04-11 18:02:35 +0100
commit80e4786f5a0673c37821ba373e78c4fb58274314 (patch)
treed5ce862b2b832ef01feea666329d57cd10669d13 /source/pdf/pdf-xref.c
parent5fcc668d4d6ec0e5ffb7bf168d8fc9669d0c7d97 (diff)
downloadmupdf-80e4786f5a0673c37821ba373e78c4fb58274314.tar.xz
Bug 696696: Avoid leak when cleaning with sanitize.
If we rewrite a page content stream, and then drop that entire page we shouldn't leak the buffer. Or to put it another way, when we change the obj for an xref entry, ditch the cached stm_buf.
Diffstat (limited to 'source/pdf/pdf-xref.c')
-rw-r--r--source/pdf/pdf-xref.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 6eca8a74..e915b600 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -1735,7 +1735,11 @@ pdf_load_obj_stm(fz_context *ctx, pdf_document *doc, int num, int gen, pdf_lexbu
pdf_drop_obj(ctx, obj);
}
else
+ {
entry->obj = obj;
+ fz_drop_buffer(ctx, entry->stm_buf);
+ entry->stm_buf = NULL;
+ }
if (numbuf[i] == target)
ret_entry = entry;
}