vim-patch:8.1.0660: sign_cleanup() may leak memory

Problem:    sign_cleanup() may leak memory.
Solution:   Free the group name before returning.  Add a few more tests.
            (Yegappan Lakshmanan)
1ea88a3e12
This commit is contained in:
Andrej Zieger
2019-05-17 12:20:22 +02:00
parent 09c236ba5c
commit 88720c626e
2 changed files with 18 additions and 9 deletions

View File

@@ -15717,7 +15717,7 @@ f_sign_unplace(typval_T *argvars, typval_T *rettv)
if (argvars[1].v_type != VAR_DICT)
{
EMSG(_(e_dictreq));
return;
goto cleanup;
}
dict = argvars[1].vval.v_dict;
@@ -15728,7 +15728,7 @@ f_sign_unplace(typval_T *argvars, typval_T *rettv)
{
EMSG2(_("E158: Invalid buffer name: %s"),
tv_get_string(&di->di_tv));
return;
goto cleanup;
}
}
if (tv_dict_find(dict, (char_u *)"id", -1) != NULL)
@@ -15747,6 +15747,8 @@ f_sign_unplace(typval_T *argvars, typval_T *rettv)
if (sign_unplace(sign_id, group, buf, 0) == OK)
rettv->vval.v_number = 0;
}
cleanup:
xfree(group);
}