patch 9.1.1740: Memory leak with wildmode=longest,full and wildoptions=pum

Problem:  Memory leak with wildmode=longest,full and wildoptions=pum
          (after 9.1.1737).
Solution: Avoid using showmatches() and WILD_NEXT together.  Also fix
          wildmode=longest,noselect:full selecting wrong item
          (zeertzjq).

fixes: #18228
closes: #18229

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-09-07 17:17:39 +02:00
committed by Christian Brabandt
parent 1ed2ff77d8
commit c7f235bd43
4 changed files with 33 additions and 5 deletions

View File

@ -1032,12 +1032,11 @@ cmdline_wildchar_complete(
if (wim_list_next || (p_wmnu && (wim_full_next
|| wim_noselect_next)))
{
if (wim_noselect_next)
options |= WILD_NOSELECT;
if (wim_full_next || wim_noselect_next)
if (wim_full_next && !wim_noselect_next)
nextwild(xp, WILD_NEXT, options, escape);
(void)showmatches(xp, p_wmnu, wim_list_next,
wim_noselect_next);
else
(void)showmatches(xp, p_wmnu, wim_list_next,
wim_noselect_next);
if (wim_list_next)
*did_wild_list = TRUE;
}