To: vim_dev@googlegroups.com Subject: Patch 8.2.4158 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4158 Problem: MS-Windows: memory leak in :browse. Solution: Free stuff before returning. (Ken Takata, closes #9574) Files: src/gui_w32.c *** ../vim-8.2.4157/src/gui_w32.c 2022-01-20 12:44:23.519631795 +0000 --- src/gui_w32.c 2022-01-20 15:03:40.609097256 +0000 *************** *** 3587,3592 **** --- 3587,3593 ---- WCHAR *initdirp = NULL; WCHAR *filterp; char_u *p, *q; + BOOL ret; if (dflt == NULL) fileBuf[0] = NUL; *************** *** 3655,3676 **** fileStruct.Flags |= OFN_NODEREFERENCELINKS; # endif if (saving) ! { ! if (!GetSaveFileNameW(&fileStruct)) ! return NULL; ! } else ! { ! if (!GetOpenFileNameW(&fileStruct)) ! return NULL; ! } vim_free(filterp); vim_free(initdirp); vim_free(titlep); vim_free(extp); ! // Convert from UCS2 to 'encoding'. p = utf16_to_enc(fileBuf, NULL); if (p == NULL) return NULL; --- 3656,3674 ---- fileStruct.Flags |= OFN_NODEREFERENCELINKS; # endif if (saving) ! ret = GetSaveFileNameW(&fileStruct); else ! ret = GetOpenFileNameW(&fileStruct); vim_free(filterp); vim_free(initdirp); vim_free(titlep); vim_free(extp); ! if (!ret) ! return NULL; ! ! // Convert from UTF-16 to 'encoding'. p = utf16_to_enc(fileBuf, NULL); if (p == NULL) return NULL; *** ../vim-8.2.4157/src/version.c 2022-01-20 14:57:18.284528166 +0000 --- src/version.c 2022-01-20 15:05:06.199427469 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4158, /**/ -- ARTHUR: Ni! BEDEVERE: Nu! ARTHUR: No. Ni! More like this. "Ni"! BEDEVERE: Ni, ni, ni! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///