summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2014-03-05 20:59:10 +0000
committerRobin Watts <robin.watts@artifex.com>2014-03-17 17:41:17 +0000
commit3f88a10ad8fc3da8c582c4524225e59cdfff12e5 (patch)
treeaef2b21b2dd8628b42b064d641422f77fd60198d
parent801c5c0781c81925ae7c7937c8595dcae780bc85 (diff)
downloadmupdf-3f88a10ad8fc3da8c582c4524225e59cdfff12e5.tar.xz
Don't drop objects if they have been modified.
This avoids leaks when pdf_clear_xref etc are used.
-rw-r--r--source/pdf/pdf-xref.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index f9b72a4d..ef238fb1 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -2491,7 +2491,9 @@ void pdf_clear_xref(pdf_document *doc)
{
pdf_xref_entry *entry = &xref->table[e];
- if (entry->obj)
+ /* We cannot drop objects if the stream buffer has
+ * been updated */
+ if (entry->obj != NULL && entry->stm_buf == NULL)
{
if (pdf_obj_refs(entry->obj) == 1)
{
@@ -2515,7 +2517,9 @@ void pdf_clear_xref_to_mark(pdf_document *doc)
{
pdf_xref_entry *entry = &xref->table[e];
- if (entry->obj)
+ /* We cannot drop objects if the stream buffer has
+ * been updated */
+ if (entry->obj != NULL && entry->stm_buf == NULL)
{
if ((entry->flags & PDF_OBJ_FLAG_MARK) == 0 && pdf_obj_refs(entry->obj) == 1)
{