diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/common/pdfapp.c | 3 | ||||
-rw-r--r-- | apps/pdfclean.c | 4 | ||||
-rw-r--r-- | apps/pdfdraw.c | 4 | ||||
-rw-r--r-- | apps/pdfextract.c | 4 | ||||
-rw-r--r-- | apps/pdfinfo.c | 4 | ||||
-rw-r--r-- | apps/pdfshow.c | 4 |
6 files changed, 23 insertions, 0 deletions
diff --git a/apps/common/pdfapp.c b/apps/common/pdfapp.c index bb15d354..7fa9310a 100644 --- a/apps/common/pdfapp.c +++ b/apps/common/pdfapp.c @@ -130,11 +130,14 @@ void pdfapp_open(pdfapp_t *app, char *filename) app->xref->root = fz_resolveindirect(obj); if (!app->xref->root) pdfapp_error(app, fz_throw("syntaxerror: missing Root object")); + fz_keepobj(app->xref->root); obj = fz_dictgets(app->xref->trailer, "Info"); app->xref->info = fz_resolveindirect(obj); if (!app->xref->info) pdfapp_warn(app, "Could not load PDF meta information."); + if (app->xref->info) + fz_keepobj(app->xref->info); error = pdf_loadnametrees(app->xref); if (error) diff --git a/apps/pdfclean.c b/apps/pdfclean.c index bfc94a36..211c461d 100644 --- a/apps/pdfclean.c +++ b/apps/pdfclean.c @@ -62,9 +62,13 @@ void openxref(char *filename, char *password) /* TODO: move into mupdf lib, see pdfapp_open in pdfapp.c */ obj = fz_dictgets(xref->trailer, "Root"); xref->root = fz_resolveindirect(obj); + if (xref->root) + fz_keepobj(xref->root); obj = fz_dictgets(xref->trailer, "Info"); xref->info = fz_resolveindirect(obj); + if (xref->info) + fz_keepobj(xref->info); } /* diff --git a/apps/pdfdraw.c b/apps/pdfdraw.c index a5bd6063..d26d4b9b 100644 --- a/apps/pdfdraw.c +++ b/apps/pdfdraw.c @@ -71,9 +71,13 @@ void openxref(char *filename, char *password) /* TODO: move into mupdf lib, see pdfapp_open in pdfapp.c */ obj = fz_dictgets(xref->trailer, "Root"); xref->root = fz_resolveindirect(obj); + if (xref->root) + fz_keepobj(xref->root); obj = fz_dictgets(xref->trailer, "Info"); xref->info = fz_resolveindirect(obj); + if (xref->info) + fz_keepobj(xref->info); } /* diff --git a/apps/pdfextract.c b/apps/pdfextract.c index b878621c..1e7e9473 100644 --- a/apps/pdfextract.c +++ b/apps/pdfextract.c @@ -45,9 +45,13 @@ void openxref(char *filename, char *password) /* TODO: move into mupdf lib, see pdfapp_open in pdfapp.c */ obj = fz_dictgets(xref->trailer, "Root"); xref->root = fz_resolveindirect(obj); + if (xref->root) + fz_keepobj(xref->root); obj = fz_dictgets(xref->trailer, "Info"); xref->info = fz_resolveindirect(obj); + if (xref->info) + fz_keepobj(xref->info); } void closexref() diff --git a/apps/pdfinfo.c b/apps/pdfinfo.c index 4d3ed2bc..a1cb3fcd 100644 --- a/apps/pdfinfo.c +++ b/apps/pdfinfo.c @@ -96,9 +96,13 @@ void opensrc(char *filename, char *password, int loadpages) /* TODO: move into mupdf lib, see pdfapp_open in pdfapp.c */ obj = fz_dictgets(src->trailer, "Root"); src->root = fz_resolveindirect(obj); + if (src->root) + fz_keepobj(src->root); obj = fz_dictgets(src->trailer, "Info"); src->info = fz_resolveindirect(obj); + if (src->info) + fz_keepobj(src->info); error = pdf_loadnametrees(src); if (error) diff --git a/apps/pdfshow.c b/apps/pdfshow.c index 981d5b4b..994a885c 100644 --- a/apps/pdfshow.c +++ b/apps/pdfshow.c @@ -45,9 +45,13 @@ void openxref(char *filename, char *password) /* TODO: move into mupdf lib, see pdfapp_open in pdfapp.c */ obj = fz_dictgets(xref->trailer, "Root"); xref->root = fz_resolveindirect(obj); + if (xref->root) + fz_keepobj(xref->root); obj = fz_dictgets(xref->trailer, "Info"); xref->info = fz_resolveindirect(obj); + if (xref->info) + fz_keepobj(xref->info); } void closexref() |