summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2011-10-12 18:31:33 +0200
committerSebastian Rasmussen <sebras@gmail.com>2011-10-12 18:33:14 +0200
commitc5918f8ec97a9e914666da4a4b4da5bb81f9a77c (patch)
tree010248f7eb4ad558d51c7e5592e4fdff7b80e9f5
parent38abc1f9a91207569b64fc274ccb904094ac4f9a (diff)
downloadmupdf-c5918f8ec97a9e914666da4a4b4da5bb81f9a77c.tar.xz
Make sure PDF title is always an allocated string.
Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
-rw-r--r--apps/pdfapp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index e96b94e6..3050145f 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -139,7 +139,7 @@ static void pdfapp_open_pdf(pdfapp_t *app, char *filename, int fd)
app->outline = pdf_load_outline(app->xref);
- app->doctitle = filename;
+ app->doctitle = fz_strdup(filename);
if (strrchr(app->doctitle, '\\'))
app->doctitle = strrchr(app->doctitle, '\\') + 1;
if (strrchr(app->doctitle, '/'))
@@ -174,7 +174,7 @@ static void pdfapp_open_xps(pdfapp_t *app, char *filename, int fd)
pdfapp_error(app, fz_rethrow(error, "cannot open document '%s'", filename));
fz_close(file);
- app->doctitle = filename;
+ app->doctitle = fz_strdup(filename);
app->pagecount = xps_count_pages(app->xps);
}