diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-03-14 13:48:51 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-03-14 13:51:55 +0100 |
commit | 0eafbf0701d9d3676d6373e35801591b115943b0 (patch) | |
tree | a5f91e59afc6ca2ec27fc5c55779d004126cdfe0 /apps | |
parent | dcd46be075472a8899429416f9484d246929600b (diff) | |
download | mupdf-0eafbf0701d9d3676d6373e35801591b115943b0.tar.xz |
Fix memory leaks in style sheet handling of the new text device.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/mudraw.c | 3 | ||||
-rw-r--r-- | apps/pdfapp.c | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/apps/mudraw.c b/apps/mudraw.c index 29517873..a0abc022 100644 --- a/apps/mudraw.c +++ b/apps/mudraw.c @@ -530,6 +530,9 @@ int main(int argc, char **argv) printf("</style>\n"); } + if (showtext) + fz_free_text_sheet(ctx, sheet); + if (showtime) { printf("total %dms / %d pages for an average of %dms\n", diff --git a/apps/pdfapp.c b/apps/pdfapp.c index acad7c9f..556368ec 100644 --- a/apps/pdfapp.c +++ b/apps/pdfapp.c @@ -160,6 +160,10 @@ void pdfapp_close(pdfapp_t *app) fz_free_text_page(app->ctx, app->page_text); app->page_text = NULL; + if (app->page_sheet) + fz_free_text_sheet(app->ctx, app->page_sheet); + app->page_sheet = NULL; + if (app->page_links) fz_drop_link(app->ctx, app->page_links); app->page_links = NULL; @@ -232,11 +236,19 @@ static void pdfapp_loadpage(pdfapp_t *app) fz_free_display_list(app->ctx, app->page_list); if (app->page_text) fz_free_text_page(app->ctx, app->page_text); + if (app->page_sheet) + fz_free_text_sheet(app->ctx, app->page_sheet); if (app->page_links) fz_drop_link(app->ctx, app->page_links); if (app->page) fz_free_page(app->doc, app->page); + app->page_list = NULL; + app->page_text = NULL; + app->page_sheet = NULL; + app->page_links = NULL; + app->page = NULL; + fz_try(app->ctx) { app->page = fz_load_page(app->doc, app->pageno - 1); |