From b4ad427e758129321166b8fae2e112e01c39a261 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 4 Mar 2014 15:57:54 +0000 Subject: Fix memory leaks in pdf-filter code. We were never freeing the top level filter_gstate, and we were losing a reference to each new resource type dictionary when we create them. --- source/pdf/pdf-op-filter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/pdf/pdf-op-filter.c b/source/pdf/pdf-op-filter.c index b938141d..52e38883 100644 --- a/source/pdf/pdf-op-filter.c +++ b/source/pdf/pdf-op-filter.c @@ -59,7 +59,7 @@ static void insert_resource(pdf_csi *csi, pdf_filter_state *state, const char *k xobj = pdf_dict_gets(state->resources, key); if (xobj == NULL) { xobj = pdf_new_dict(csi->doc, 1); - pdf_dict_puts(state->resources, key, xobj); + pdf_dict_puts_drop(state->resources, key, xobj); } pdf_dict_putp(xobj, csi->name, obj); } @@ -1069,6 +1069,7 @@ free_processor_filter(pdf_csi *csi, void *state_) } call_op(csi, state, PDF_OP_END); + fz_free(state->ctx, state->gstate); fz_free(state->ctx, state); } -- cgit v1.2.3