diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2016-10-15 01:55:05 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2016-10-18 21:32:14 +0800 |
commit | ce82537df9e4b832213138d942be4482418b9e50 (patch) | |
tree | 77745cba1b3c7ffaca9db4876e20993fc0495801 /source/fitz | |
parent | 23ac569165b66403abfe72e89007675ceaa9bde0 (diff) | |
download | mupdf-ce82537df9e4b832213138d942be4482418b9e50.tar.xz |
All external drop functions handles NULL.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/hash.c | 3 | ||||
-rw-r--r-- | source/fitz/image.c | 3 | ||||
-rw-r--r-- | source/fitz/link.c | 3 | ||||
-rw-r--r-- | source/fitz/pool.c | 7 | ||||
-rw-r--r-- | source/fitz/writer.c | 3 | ||||
-rw-r--r-- | source/fitz/zip.c | 2 |
6 files changed, 20 insertions, 1 deletions
diff --git a/source/fitz/hash.c b/source/fitz/hash.c index 31a692c0..e16aefd1 100644 --- a/source/fitz/hash.c +++ b/source/fitz/hash.c @@ -96,6 +96,9 @@ fz_hash_get_val(fz_context *ctx, fz_hash_table *table, int idx) void fz_drop_hash(fz_context *ctx, fz_hash_table *table) { + if (!table) + return; + fz_free(ctx, table->ents); fz_free(ctx, table); } diff --git a/source/fitz/image.c b/source/fitz/image.c index 48420a81..7373147f 100644 --- a/source/fitz/image.c +++ b/source/fitz/image.c @@ -376,6 +376,9 @@ fz_drop_image_imp(fz_context *ctx, fz_storable *image_) void fz_drop_image_base(fz_context *ctx, fz_image *image) { + if (!image) + return; + fz_drop_colorspace(ctx, image->colorspace); fz_drop_image(ctx, image->mask); fz_free(ctx, image); diff --git a/source/fitz/link.c b/source/fitz/link.c index 20668ab1..eaed1402 100644 --- a/source/fitz/link.c +++ b/source/fitz/link.c @@ -3,6 +3,9 @@ void fz_drop_link_dest(fz_context *ctx, fz_link_dest *dest) { + if (!dest) + return; + switch (dest->kind) { case FZ_LINK_NONE: diff --git a/source/fitz/pool.c b/source/fitz/pool.c index 2591c563..90c405dc 100644 --- a/source/fitz/pool.c +++ b/source/fitz/pool.c @@ -41,7 +41,12 @@ char *fz_pool_strdup(fz_context *ctx, fz_pool *pool, const char *s) void fz_drop_pool(fz_context *ctx, fz_pool *pool) { - fz_pool_node *node = pool->head; + fz_pool_node *node; + + if (!pool) + return; + + node = pool->head; while (node) { fz_pool_node *next = node->next; diff --git a/source/fitz/writer.c b/source/fitz/writer.c index d7fd60f9..fe9e8635 100644 --- a/source/fitz/writer.c +++ b/source/fitz/writer.c @@ -82,6 +82,9 @@ fz_close_document_writer(fz_context *ctx, fz_document_writer *wri) void fz_drop_document_writer(fz_context *ctx, fz_document_writer *wri) { + if (!wri) + return; + if (wri->close_writer) fz_warn(ctx, "dropping unclosed document writer"); if (wri->drop_writer) diff --git a/source/fitz/zip.c b/source/fitz/zip.c index 599d2954..95f1bd03 100644 --- a/source/fitz/zip.c +++ b/source/fitz/zip.c @@ -87,6 +87,8 @@ fz_close_zip_writer(fz_context *ctx, fz_zip_writer *zip) void fz_drop_zip_writer(fz_context *ctx, fz_zip_writer *zip) { + if (!zip) + return; if (!zip->closed) fz_warn(ctx, "dropping unclosed zip writer"); fz_drop_output(ctx, zip->output); |