diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-04-28 19:16:02 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-04-28 19:16:49 +0100 |
commit | ad13312fc42a236750fbea697a07e4109fae8513 (patch) | |
tree | 8d0b4f37f76b934c89bbfb011872780569f35a2a /source/fitz | |
parent | 44fff08dc64d358df441a9e615bbaacf7b01d54a (diff) | |
download | mupdf-ad13312fc42a236750fbea697a07e4109fae8513.tar.xz |
Add FZ_ERROR_OOM, and make fz_malloc & co call it.
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/memory.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/fitz/memory.c b/source/fitz/memory.c index e26ddd0d..15c86cb6 100644 --- a/source/fitz/memory.c +++ b/source/fitz/memory.c @@ -56,7 +56,7 @@ fz_malloc(fz_context *ctx, unsigned int size) p = do_scavenging_malloc(ctx, size); if (!p) - fz_throw(ctx, FZ_ERROR_GENERIC, "malloc of %d bytes failed", size); + fz_throw(ctx, FZ_ERROR_OOM, "malloc of %d bytes failed", size); return p; } @@ -75,11 +75,11 @@ fz_malloc_array(fz_context *ctx, unsigned int count, unsigned int size) return 0; if (count > UINT_MAX / size) - fz_throw(ctx, FZ_ERROR_GENERIC, "malloc of array (%d x %d bytes) failed (integer overflow)", count, size); + fz_throw(ctx, FZ_ERROR_OOM, "malloc of array (%d x %d bytes) failed (integer overflow)", count, size); p = do_scavenging_malloc(ctx, count * size); if (!p) - fz_throw(ctx, FZ_ERROR_GENERIC, "malloc of array (%d x %d bytes) failed", count, size); + fz_throw(ctx, FZ_ERROR_OOM, "malloc of array (%d x %d bytes) failed", count, size); return p; } @@ -108,13 +108,13 @@ fz_calloc(fz_context *ctx, unsigned int count, unsigned int size) if (count > UINT_MAX / size) { - fz_throw(ctx, FZ_ERROR_GENERIC, "calloc (%d x %d bytes) failed (integer overflow)", count, size); + fz_throw(ctx, FZ_ERROR_OOM, "calloc (%d x %d bytes) failed (integer overflow)", count, size); } p = do_scavenging_malloc(ctx, count * size); if (!p) { - fz_throw(ctx, FZ_ERROR_GENERIC, "calloc (%d x %d bytes) failed", count, size); + fz_throw(ctx, FZ_ERROR_OOM, "calloc (%d x %d bytes) failed", count, size); } memset(p, 0, count*size); return p; @@ -154,11 +154,11 @@ fz_resize_array(fz_context *ctx, void *p, unsigned int count, unsigned int size) } if (count > UINT_MAX / size) - fz_throw(ctx, FZ_ERROR_GENERIC, "resize array (%d x %d bytes) failed (integer overflow)", count, size); + fz_throw(ctx, FZ_ERROR_OOM, "resize array (%d x %d bytes) failed (integer overflow)", count, size); np = do_scavenging_realloc(ctx, p, count * size); if (!np) - fz_throw(ctx, FZ_ERROR_GENERIC, "resize array (%d x %d bytes) failed", count, size); + fz_throw(ctx, FZ_ERROR_OOM, "resize array (%d x %d bytes) failed", count, size); return np; } |