mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.0382: freeing the wrong string on failure
Problem: Freeing the wrong string on failure. Solution: Adjust the argument. Reorder the code.
This commit is contained in:
@@ -703,6 +703,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
382,
|
||||||
/**/
|
/**/
|
||||||
381,
|
381,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -937,21 +937,22 @@ add_defer_function(char_u *name, int argcount, typval_T *argvars)
|
|||||||
if (dfunc->df_defer_var_idx == 0)
|
if (dfunc->df_defer_var_idx == 0)
|
||||||
{
|
{
|
||||||
iemsg("df_defer_var_idx is zero");
|
iemsg("df_defer_var_idx is zero");
|
||||||
vim_free(func_tv.vval.v_string);
|
vim_free(name);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
func_tv.v_type = VAR_FUNC;
|
|
||||||
func_tv.v_lock = 0;
|
|
||||||
func_tv.vval.v_string = name;
|
|
||||||
|
|
||||||
l = add_defer_item(dfunc->df_defer_var_idx - 1, 1, current_ectx);
|
l = add_defer_item(dfunc->df_defer_var_idx - 1, 1, current_ectx);
|
||||||
if (l == NULL)
|
if (l == NULL)
|
||||||
{
|
{
|
||||||
vim_free(func_tv.vval.v_string);
|
vim_free(name);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func_tv.v_type = VAR_FUNC;
|
||||||
|
func_tv.v_lock = 0;
|
||||||
|
func_tv.vval.v_string = name;
|
||||||
list_set_item(l, 0, &func_tv);
|
list_set_item(l, 0, &func_tv);
|
||||||
|
|
||||||
for (i = 0; i < argcount; ++i)
|
for (i = 0; i < argcount; ++i)
|
||||||
list_set_item(l, i + 1, argvars + i);
|
list_set_item(l, i + 1, argvars + i);
|
||||||
return OK;
|
return OK;
|
||||||
|
Reference in New Issue
Block a user