summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2013-02-19 16:42:08 +0100
committerTor Andersson <tor.andersson@artifex.com>2013-02-19 18:46:52 +0100
commit3db5d5f56a5ec305f57ba7c2c4b12c1d3292b074 (patch)
tree848f40ca8e809193c10f42072c25b32a84a5cf0b /fitz
parent55d60e4fc9460d889f27fd06610309e0f748b825 (diff)
downloadmupdf-3db5d5f56a5ec305f57ba7c2c4b12c1d3292b074.tar.xz
Bug 693639: don't take references on global (static) resource objects.
Thanks to zeniko.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/res_store.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fitz/res_store.c b/fitz/res_store.c
index a76cfbb0..c8c1ed5f 100644
--- a/fitz/res_store.c
+++ b/fitz/res_store.c
@@ -267,7 +267,8 @@ fz_store_item(fz_context *ctx, void *key, void *val_, unsigned int itemsize, fz_
if (existing)
{
/* Take a new reference */
- existing->val->refs++;
+ if (existing->val->refs > 0)
+ existing->val->refs++;
fz_unlock(ctx, FZ_LOCK_ALLOC);
fz_free(ctx, item);
return existing->val;