Problem: Possible double free in fill_partial_and_closure()
(xuqing yang)
Solution: Let the caller handle the free()
Signed-off-by: Christian Brabandt <cb@256bit.org>
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 527,
/**/
526,
/**/
// and local variables) so that the closure can use it later.
// Store a reference to the partial so we can handle that.
if (GA_GROW_FAILS(&ectx->ec_funcrefs, 1))
- {
- vim_free(pt);
+ // caller needs to free pt
return FAIL;
- }
// Extra variable keeps the count of closures created in the current
// function call.
++(((typval_T *)ectx->ec_stack.ga_data) + ectx->ec_frame_idx
if (fill_partial_and_closure(pt, ufunc,
extra == NULL ? NULL : &extra->fre_loopvar_info,
ectx) == FAIL)
+ {
+ vim_free(pt);
goto theend;
+ }
tv = STACK_TV_BOT(0);
++ectx->ec_stack.ga_len;
tv->vval.v_partial = pt;