diff options
Diffstat (limited to 'source/fitz/memory.c')
-rw-r--r-- | source/fitz/memory.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/fitz/memory.c b/source/fitz/memory.c index 09df7cda..8ba343e5 100644 --- a/source/fitz/memory.c +++ b/source/fitz/memory.c @@ -198,9 +198,12 @@ fz_resize_array_no_throw(fz_context *ctx, void *p, size_t count, size_t size) void fz_free(fz_context *ctx, void *p) { - fz_lock(ctx, FZ_LOCK_ALLOC); - ctx->alloc->free(ctx->alloc->user, p); - fz_unlock(ctx, FZ_LOCK_ALLOC); + if (p) + { + fz_lock(ctx, FZ_LOCK_ALLOC); + ctx->alloc->free(ctx->alloc->user, p); + fz_unlock(ctx, FZ_LOCK_ALLOC); + } } char * |