diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-01-20 11:54:02 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-01-20 16:55:41 +0000 |
commit | 8e59740d3ac9e6cdcc08baf1745f0808f2dc9df5 (patch) | |
tree | 8f14c985ab7e29e932b3c226e0754a6b6943594f /fitz/base_memory.c | |
parent | 33d225213dac1217a86c00d0e8e8ca6d7503cbb2 (diff) | |
download | mupdf-8e59740d3ac9e6cdcc08baf1745f0808f2dc9df5.tar.xz |
Fix locking problems.
Thanks to filmor's help, fix some problems where locking was going
wrong; in 2 cases we failed to unlock, and in 2 cases we tried to
free (which relocks) while already locked.
All simple fixes.
Diffstat (limited to 'fitz/base_memory.c')
-rw-r--r-- | fitz/base_memory.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fitz/base_memory.c b/fitz/base_memory.c index c9b94f1e..776bdce6 100644 --- a/fitz/base_memory.c +++ b/fitz/base_memory.c @@ -10,7 +10,10 @@ do_scavenging_malloc(fz_context *ctx, unsigned int size) do { p = ctx->alloc->malloc(ctx->alloc->user, size); if (p != NULL) + { + fz_unlock(ctx); return p; + } } while (fz_store_scavenge(ctx, size, &phase)); fz_unlock(ctx); @@ -27,7 +30,10 @@ do_scavenging_realloc(fz_context *ctx, void *p, unsigned int size) do { q = ctx->alloc->realloc(ctx->alloc->user, p, size); if (q != NULL) + { + fz_unlock(ctx); return q; + } } while (fz_store_scavenge(ctx, size, &phase)); fz_unlock(ctx); |