summaryrefslogtreecommitdiff
path: root/xps/xps_zip.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-04-03 22:09:06 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-04-03 22:09:06 +0200
commit9eb7d89c1609f9ebec4ab8545c95de3f8874e2da (patch)
treea22983e0ba7f1c811408b44a45a329f6ee622e0f /xps/xps_zip.c
parent5ea6c5701e7ec3f738a8adb6d20790edcda781ba (diff)
downloadmupdf-9eb7d89c1609f9ebec4ab8545c95de3f8874e2da.tar.xz
xps: Plug memory leaks.
Diffstat (limited to 'xps/xps_zip.c')
-rw-r--r--xps/xps_zip.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/xps/xps_zip.c b/xps/xps_zip.c
index d353ec11..abb78832 100644
--- a/xps/xps_zip.c
+++ b/xps/xps_zip.c
@@ -451,6 +451,11 @@ static void xps_free_font_func(void *ptr)
fz_dropfont(ptr);
}
+static void xps_free_colorspace_func(void *ptr)
+{
+ fz_dropcolorspace(ptr);
+}
+
int
xps_free_context(xps_context *ctx)
{
@@ -459,14 +464,19 @@ xps_free_context(xps_context *ctx)
if (ctx->file)
fclose(ctx->file);
+ if (ctx->start_part)
+ fz_free(ctx->start_part);
+
for (i = 0; i < ctx->zip_count; i++)
fz_free(ctx->zip_table[i].name);
fz_free(ctx->zip_table);
xps_hash_free(ctx->font_table, xps_free_key_func, xps_free_font_func);
- xps_hash_free(ctx->colorspace_table, xps_free_key_func, NULL);
+ xps_hash_free(ctx->colorspace_table, xps_free_key_func, xps_free_colorspace_func);
xps_free_page_list(ctx);
+ fz_free(ctx);
+
return 0;
}