summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-js.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-12-22 11:25:52 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-12-27 15:06:51 +0100
commitc21d2afbe921fb8b12e07a2eccdf7cf7a0e2bf61 (patch)
tree22bade79fd3fb3b5d06ae46f759d11a4d1346f20 /source/pdf/pdf-js.c
parent0805c1add0e3fc951d16c27d3837bc5123842303 (diff)
downloadmupdf-c21d2afbe921fb8b12e07a2eccdf7cf7a0e2bf61.tar.xz
js: Fix allocator callbacks so they don't throw fitz exceptions.
Valgrind doesn't know realloc(p, 0) is equivalent to free(p), so unfortunately we can't reduce all calls to just realloc().
Diffstat (limited to 'source/pdf/pdf-js.c')
-rw-r--r--source/pdf/pdf-js.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/source/pdf/pdf-js.c b/source/pdf/pdf-js.c
index f3a2ca80..aeba801c 100644
--- a/source/pdf/pdf-js.c
+++ b/source/pdf/pdf-js.c
@@ -589,9 +589,7 @@ static void *pdf_js_alloc(void *actx, void *ptr, int n)
fz_free(ctx, ptr);
return NULL;
}
- if (ptr)
- return fz_resize_array(ctx, ptr, n, 1);
- return fz_malloc_array(ctx, n, 1);
+ return fz_resize_array_no_throw(ctx, ptr, n, 1);
}
static pdf_js *pdf_new_js(fz_context *ctx, pdf_document *doc)