From a43bac812d152761b03c1e080d452e7595e78754 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Wed, 22 Aug 2018 20:38:58 +0800 Subject: Plug leak of buffer when button widgets are ignored. The leak was triggered by the PDF from 699576, but this commit does not fully fix that bug. --- source/pdf/pdf-appearance.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c index b19294bd..ceadfd09 100644 --- a/source/pdf/pdf-appearance.c +++ b/source/pdf/pdf-appearance.c @@ -1320,7 +1320,7 @@ void pdf_update_appearance(fz_context *ctx, pdf_annot *annot) { fz_rect rect, bbox; fz_matrix matrix = fz_identity; - fz_buffer *buf = fz_new_buffer(ctx, 1024); + fz_buffer *buf; pdf_obj *res = NULL; pdf_obj *new_ap_n = NULL; fz_var(res); @@ -1333,6 +1333,7 @@ void pdf_update_appearance(fz_context *ctx, pdf_annot *annot) if (pdf_name_eq(ctx, pdf_dict_get_inheritable(ctx, annot->obj, PDF_NAME(FT)), PDF_NAME(Btn))) return; + buf = fz_new_buffer(ctx, 1024); fz_try(ctx) { rect = pdf_dict_get_rect(ctx, annot->obj, PDF_NAME(Rect)); -- cgit v1.2.3