Browse Source

Fix duk_hboundfunc->args memory leak

pull/1748/head
Sami Vaarala 7 years ago
parent
commit
da5a98baca
  1. 2
      src-input/duk_hboundfunc.h
  2. 5
      src-input/duk_heap_alloc.c

2
src-input/duk_hboundfunc.h

@ -33,7 +33,7 @@ struct duk_hboundfunc {
duk_tval this_binding; duk_tval this_binding;
/* Arguments to prepend. */ /* Arguments to prepend. */
duk_tval *args; duk_tval *args; /* Separate allocation. */
duk_idx_t nargs; duk_idx_t nargs;
}; };

5
src-input/duk_heap_alloc.c

@ -65,7 +65,12 @@ DUK_INTERNAL void duk_free_hobject(duk_heap *heap, duk_hobject *h) {
* to be unwound to update the 'caller' properties of * to be unwound to update the 'caller' properties of
* functions in the callstack. * functions in the callstack.
*/ */
} else if (DUK_HOBJECT_IS_BOUNDFUNC(h)) {
duk_hboundfunc *f = (duk_hboundfunc *) h;
DUK_FREE(heap, f->args);
} }
DUK_FREE(heap, (void *) h); DUK_FREE(heap, (void *) h);
} }

Loading…
Cancel
Save