summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-07-24 18:12:58 +0100
committerRobin Watts <robin.watts@artifex.com>2013-07-24 18:13:44 +0100
commit3c51806fe29870893aba912297006acdaa141784 (patch)
tree66401e87772a2ca1016e5ec087ffc02442c45def /source/pdf
parentd1635ba9473e56b7fa73ebc1a7558dcc540fd6f4 (diff)
downloadmupdf-3c51806fe29870893aba912297006acdaa141784.tar.xz
Fix leak of pdf_field_value.
pdf_js_setup_event strdups the field value, then nothing ever uses it again.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-form.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c
index 73c9d2e5..f6e2f721 100644
--- a/source/pdf/pdf-form.c
+++ b/source/pdf/pdf-form.c
@@ -436,10 +436,22 @@ void pdf_update_appearance(pdf_document *doc, pdf_annot *annot)
{
/* Apply formatting */
pdf_js_event e;
+ fz_context *ctx = doc->ctx;
e.target = obj;
e.value = pdf_field_value(doc, obj);
- pdf_js_setup_event(doc->js, &e);
+ fz_try(ctx)
+ {
+ pdf_js_setup_event(doc->js, &e);
+ }
+ fz_always(ctx)
+ {
+ fz_free(ctx, e.value);
+ }
+ fz_catch(ctx)
+ {
+ fz_rethrow(ctx);
+ }
execute_action(doc, obj, formatting);
/* Update appearance from JS event.value */
pdf_update_text_appearance(doc, obj, pdf_js_get_event(doc->js)->value);