diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-12-22 20:30:19 +0100 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-12-22 20:30:38 +0100 |
commit | d06a844f3e9e38f6cc284f6d3d3a380b814447b4 (patch) | |
tree | b49973ec74eab47997f33acb76baa0726d1e017f | |
parent | 26637fc54aa58360cfe3a0049f35ea32dc869309 (diff) | |
download | mupdf-d06a844f3e9e38f6cc284f6d3d3a380b814447b4.tar.xz |
When document reloading fails, do not leak filename.
-rw-r--r-- | platform/x11/pdfapp.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index 63513415..7de62bf9 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -147,13 +147,10 @@ void pdfapp_invert(pdfapp_t *app, const fz_rect *rect) void pdfapp_reloadfile(pdfapp_t *app) { - fz_context *ctx = app->ctx; - char *filename = app->docpath; - - app->docpath = NULL; + char filename[PATH_MAX]; + fz_strlcpy(filename, app->docpath, PATH_MAX); pdfapp_close(app); pdfapp_open(app, filename, 1); - fz_free(ctx, filename); } static void event_cb(fz_context *ctx, pdf_document *doc, pdf_doc_event *event, void *data) |