Patch 8.2.1087

4 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 29, 2020, 3:15:39 PM6/29/20
to vim...@googlegroups.com

Patch 8.2.1087
Problem: Possible memory leak when file expansion fails.
Solution: Clear the grow array when returning FAIL. Use an error message
instead of an empty string.
Files: src/filepath.c


*** ../vim-8.2.1086/src/filepath.c 2020-06-24 20:33:59.565106319 +0200
--- src/filepath.c 2020-06-29 20:50:56.900442778 +0200
***************
*** 3813,3820 ****
vim_free(p);
}

*num_file = ga.ga_len;
! *file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data : (char_u **)"";

recursive = FALSE;

--- 3813,3825 ----
vim_free(p);
}

+ // When returning FAIL the array must be freed here.
+ if (retval == FAIL)
+ ga_clear(&ga);
+
*num_file = ga.ga_len;
! *file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data
! : (char_u **)_("no matches");

recursive = FALSE;

*** ../vim-8.2.1086/src/version.c 2020-06-29 20:40:34.026867204 +0200
--- src/version.c 2020-06-29 20:51:08.880389518 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1087,
/**/

--
FATAL ERROR! SYSTEM HALTED! - Press any key to continue doing nothing.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages