diff options
author | K.Takata <kentkt@csc.jp> | 2022-01-20 15:05:22 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-20 15:05:22 +0000 |
commit | 14b8d6ac6b50f2f4f3e7463e4c335f51a512ad30 (patch) | |
tree | 1c6cb742477a3f0ef78f61fb75e9394d002ce393 /src | |
parent | ae1bd87fe84bfb31379bc5da351bca56a3d3b571 (diff) |
patch 8.2.4158: MS-Windows: memory leak in :browsev8.2.4158
Problem: MS-Windows: memory leak in :browse.
Solution: Free stuff before returning. (Ken Takata, closes #9574)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui_w32.c | 16 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/gui_w32.c b/src/gui_w32.c index cbbae9edd6..27e36085a9 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -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; diff --git a/src/version.c b/src/version.c index b79f066f51..bde5d76795 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4158, +/**/ 4157, /**/ 4156, |