From 88141af716349b4c1154676e70732813b17a8883 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 4 Jun 2015 13:16:51 +0100 Subject: Fix leak of doc->xref_index in mutool clean. When replacing the xref_index, lose the old one. --- source/pdf/pdf-xref.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- cgit v1.2.3