mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
patch 8.2.4158: MS-Windows: memory leak in :browse
Problem: MS-Windows: memory leak in :browse. Solution: Free stuff before returning. (Ken Takata, closes #9574)
This commit is contained in:
parent
ae1bd87fe8
commit
14b8d6ac6b
@ -3587,6 +3587,7 @@ gui_mch_browse(
|
||||
WCHAR *initdirp = NULL;
|
||||
WCHAR *filterp;
|
||||
char_u *p, *q;
|
||||
BOOL ret;
|
||||
|
||||
if (dflt == NULL)
|
||||
fileBuf[0] = NUL;
|
||||
@ -3655,22 +3656,19 @@ gui_mch_browse(
|
||||
fileStruct.Flags |= OFN_NODEREFERENCELINKS;
|
||||
# endif
|
||||
if (saving)
|
||||
{
|
||||
if (!GetSaveFileNameW(&fileStruct))
|
||||
return NULL;
|
||||
}
|
||||
ret = GetSaveFileNameW(&fileStruct);
|
||||
else
|
||||
{
|
||||
if (!GetOpenFileNameW(&fileStruct))
|
||||
return NULL;
|
||||
}
|
||||
ret = GetOpenFileNameW(&fileStruct);
|
||||
|
||||
vim_free(filterp);
|
||||
vim_free(initdirp);
|
||||
vim_free(titlep);
|
||||
vim_free(extp);
|
||||
|
||||
// Convert from UCS2 to 'encoding'.
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
// Convert from UTF-16 to 'encoding'.
|
||||
p = utf16_to_enc(fileBuf, NULL);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
4158,
|
||||
/**/
|
||||
4157,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user