0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1638: leaking memory when popup filter function can't be called

Problem:    Leaking memory when popup filter function can't be called.
Solution:   Don't return too soon.
This commit is contained in:
Bram Moolenaar
2020-09-08 22:55:26 +02:00
parent c3516f7e45
commit 8e9be208ea
2 changed files with 25 additions and 21 deletions

View File

@@ -3155,11 +3155,12 @@ invoke_popup_filter(win_T *wp, int c)
if (call_callback(&wp->w_filter_cb, -1, &rettv, 2, argv) == FAIL)
{
// Cannot call the function, close the popup to avoid that the filter
// eats keys and the user can't get out.
// eats keys and the user is stuck. Might as well eat the key.
popup_close_with_retval(wp, -1);
return 1;
res = TRUE;
}
else
{
if (win_valid_popup(wp) && old_lnum != wp->w_cursor.lnum)
popup_highlight_curline(wp);
@@ -3181,6 +3182,7 @@ invoke_popup_filter(win_T *wp, int c)
--wp->w_filter_errors;
res = tv_get_bool(&rettv);
}
}
vim_free(argv[1].vval.v_string);
clear_tv(&rettv);

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1638,
/**/
1637,
/**/