summaryrefslogtreecommitdiff
path: root/source/html/epub-doc.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/html/epub-doc.c')
-rw-r--r--source/html/epub-doc.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c
index 3ad81d66..811e217e 100644
--- a/source/html/epub-doc.c
+++ b/source/html/epub-doc.c
@@ -95,10 +95,19 @@ epub_run_page(epub_document *doc, epub_page *page, fz_device *dev, const fz_matr
static void
epub_close_document(epub_document *doc)
{
- /* TODO:free all chapters */
- fz_close_archive(doc->ctx, doc->zip);
- fz_free_html_font_set(doc->ctx, doc->set);
- fz_free(doc->ctx, doc);
+ fz_context *ctx = doc->ctx;
+ epub_chapter *ch, *next;
+ ch = doc->spine;
+ while (ch)
+ {
+ next = ch->next;
+ fz_free_html(ctx, ch->box);
+ fz_free(ctx, ch);
+ ch = next;
+ }
+ fz_close_archive(ctx, doc->zip);
+ fz_free_html_font_set(ctx, doc->set);
+ fz_free(ctx, doc);
}
static const char *