diff options
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/colorspace.c | 3 | ||||
-rw-r--r-- | source/fitz/document.c | 2 | ||||
-rw-r--r-- | source/fitz/draw-edge.c | 2 | ||||
-rw-r--r-- | source/fitz/draw-glyph.c | 2 | ||||
-rw-r--r-- | source/fitz/font.c | 20 | ||||
-rw-r--r-- | source/fitz/output.c | 2 | ||||
-rw-r--r-- | source/fitz/store.c | 2 |
7 files changed, 20 insertions, 13 deletions
diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c index 6313fb70..84e9b36c 100644 --- a/source/fitz/colorspace.c +++ b/source/fitz/colorspace.c @@ -257,7 +257,10 @@ void fz_drop_colorspace_context(fz_context *ctx) if (!ctx) return; if (fz_drop_imp(ctx, ctx->colorspace, &ctx->colorspace->ctx_refs)) + { fz_free(ctx, ctx->colorspace); + ctx->colorspace = NULL; + } } fz_colorspace * diff --git a/source/fitz/document.c b/source/fitz/document.c index fdf4d2b7..43fcb133 100644 --- a/source/fitz/document.c +++ b/source/fitz/document.c @@ -31,7 +31,7 @@ fz_document_handler_context *fz_keep_document_handler_context(fz_context *ctx) void fz_drop_document_handler_context(fz_context *ctx) { - if (!ctx || !ctx->handler) + if (!ctx) return; if (fz_drop_imp(ctx, ctx->handler, &ctx->handler->refs)) diff --git a/source/fitz/draw-edge.c b/source/fitz/draw-edge.c index cd6a525f..0da45331 100644 --- a/source/fitz/draw-edge.c +++ b/source/fitz/draw-edge.c @@ -53,6 +53,8 @@ void fz_copy_aa_context(fz_context *dst, fz_context *src) void fz_drop_aa_context(fz_context *ctx) { + if (!ctx) + return; #ifndef AA_BITS fz_free(ctx, ctx->aa); ctx->aa = NULL; diff --git a/source/fitz/draw-glyph.c b/source/fitz/draw-glyph.c index a0c47b74..1eb89093 100644 --- a/source/fitz/draw-glyph.c +++ b/source/fitz/draw-glyph.c @@ -107,7 +107,7 @@ fz_purge_glyph_cache(fz_context *ctx) void fz_drop_glyph_cache_context(fz_context *ctx) { - if (!ctx->glyph_cache) + if (!ctx || !ctx->glyph_cache) return; fz_lock(ctx, FZ_LOCK_GLYPHCACHE); diff --git a/source/fitz/font.c b/source/fitz/font.c index 88d5e358..93546042 100644 --- a/source/fitz/font.c +++ b/source/fitz/font.c @@ -235,21 +235,23 @@ fz_keep_font_context(fz_context *ctx) void fz_drop_font_context(fz_context *ctx) { - int i; - if (!ctx) return; - for (i = 0; i < nelem(ctx->font->fallback); ++i) + if (fz_drop_imp(ctx, ctx->font, &ctx->font->ctx_refs)) { - fz_drop_font(ctx, ctx->font->fallback[i].serif); - fz_drop_font(ctx, ctx->font->fallback[i].sans); - } - fz_drop_font(ctx, ctx->font->symbol); - fz_drop_font(ctx, ctx->font->emoji); + int i; - if (fz_drop_imp(ctx, ctx->font, &ctx->font->ctx_refs)) + for (i = 0; i < nelem(ctx->font->fallback); ++i) + { + fz_drop_font(ctx, ctx->font->fallback[i].serif); + fz_drop_font(ctx, ctx->font->fallback[i].sans); + } + fz_drop_font(ctx, ctx->font->symbol); + fz_drop_font(ctx, ctx->font->emoji); fz_free(ctx, ctx->font); + ctx->font = NULL; + } } void fz_install_load_system_font_funcs(fz_context *ctx, fz_load_system_font_func f, fz_load_system_cjk_font_func f_cjk) diff --git a/source/fitz/output.c b/source/fitz/output.c index d5dfb47e..ee3f5b6f 100644 --- a/source/fitz/output.c +++ b/source/fitz/output.c @@ -45,7 +45,7 @@ fz_keep_output_context(fz_context *ctx) void fz_drop_output_context(fz_context *ctx) { - if (!ctx || !ctx->output) + if (!ctx) return; if (fz_drop_imp(ctx, ctx->output, &ctx->output->refs)) diff --git a/source/fitz/store.c b/source/fitz/store.c index 2c8a7022..c85ceab2 100644 --- a/source/fitz/store.c +++ b/source/fitz/store.c @@ -661,7 +661,7 @@ fz_keep_store_context(fz_context *ctx) void fz_drop_store_context(fz_context *ctx) { - if (ctx == NULL || ctx->store == NULL) + if (!ctx) return; if (fz_drop_imp(ctx, ctx->store, &ctx->store->refs)) { |