diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-07-12 13:04:28 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-07-12 14:45:46 +0200 |
commit | 5d70d34fb639e8f46bb9246d84020f9e3b307b6a (patch) | |
tree | 9d2a6b3d161cce51ffedcb853391e3428ca94d62 /source/tools | |
parent | 8abdcfd3c1cc410d705cb7df07bdfc9203af99ac (diff) | |
download | mupdf-5d70d34fb639e8f46bb9246d84020f9e3b307b6a.tar.xz |
js: Fix memory leak in new Image().
Diffstat (limited to 'source/tools')
-rw-r--r-- | source/tools/murun.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c index fb35f0a0..bf329540 100644 --- a/source/tools/murun.c +++ b/source/tools/murun.c @@ -550,6 +550,12 @@ static void ffi_pushimage(js_State *J, fz_image *image) js_newuserdata(J, "fz_image", fz_keep_image(ctx, image), ffi_gc_fz_image); } +static void ffi_pushimage_own(js_State *J, fz_image *image) +{ + js_getregistry(J, "fz_image"); + js_newuserdata(J, "fz_image", image, ffi_gc_fz_image); +} + static int is_number(const char *key, int *idx) { char *end; @@ -1851,7 +1857,7 @@ static void ffi_new_Image(js_State *J) rethrow(J); } - ffi_pushimage(J, image); + ffi_pushimage_own(J, image); } static void ffi_Image_getWidth(js_State *J) |