summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2015-06-04 13:16:51 +0100
committerRobin Watts <Robin.Watts@artifex.com>2015-06-05 08:04:48 -0700
commit88141af716349b4c1154676e70732813b17a8883 (patch)
tree856da794efc1dbfb7a2d32cf4016461c11ea1830 /source/pdf
parent36316b400e48e0ee64ee1a016c8bde68785b7dc0 (diff)
downloadmupdf-88141af716349b4c1154676e70732813b17a8883.tar.xz
Fix leak of doc->xref_index in mutool clean.
When replacing the xref_index, lose the old one.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-xref.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index e06ae224..2341ddd9 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -428,6 +428,8 @@ void pdf_replace_xref(fz_context *ctx, pdf_document *doc, pdf_xref_entry *entrie
fz_var(xref);
fz_try(ctx)
{
+ fz_free(ctx, doc->xref_index);
+ doc->xref_index = NULL; /* In case the calloc fails */
doc->xref_index = fz_calloc(ctx, n, sizeof(int));
xref = fz_malloc_struct(ctx, pdf_xref);
sub = fz_malloc_struct(ctx, pdf_xref_subsec);