- patchlevel 871
This commit is contained in:
parent
54d6b10e61
commit
510c26757d
191
7.4.871
Normal file
191
7.4.871
Normal file
@ -0,0 +1,191 @@
|
||||
To: vim_dev@googlegroups.com
|
||||
Subject: Patch 7.4.871
|
||||
Fcc: outbox
|
||||
From: Bram Moolenaar <Bram@moolenaar.net>
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
------------
|
||||
|
||||
Patch 7.4.871
|
||||
Problem: Vim leaks memory, when 'wildignore' filters out all matches.
|
||||
Solution: Free the files array when it becomes empty.
|
||||
Files: src/misc1.c
|
||||
|
||||
|
||||
*** ../vim-7.4.870/src/misc1.c 2015-09-01 16:25:28.357392851 +0200
|
||||
--- src/misc1.c 2015-09-15 19:00:07.569914562 +0200
|
||||
***************
|
||||
*** 9697,9710 ****
|
||||
/*
|
||||
* Expand wildcards. Calls gen_expand_wildcards() and removes files matching
|
||||
* 'wildignore'.
|
||||
! * Returns OK or FAIL. When FAIL then "num_file" won't be set.
|
||||
*/
|
||||
int
|
||||
! expand_wildcards(num_pat, pat, num_file, file, flags)
|
||||
int num_pat; /* number of input patterns */
|
||||
char_u **pat; /* array of input patterns */
|
||||
! int *num_file; /* resulting number of files */
|
||||
! char_u ***file; /* array of resulting files */
|
||||
int flags; /* EW_DIR, etc. */
|
||||
{
|
||||
int retval;
|
||||
--- 9697,9710 ----
|
||||
/*
|
||||
* Expand wildcards. Calls gen_expand_wildcards() and removes files matching
|
||||
* 'wildignore'.
|
||||
! * Returns OK or FAIL. When FAIL then "num_files" won't be set.
|
||||
*/
|
||||
int
|
||||
! expand_wildcards(num_pat, pat, num_files, files, flags)
|
||||
int num_pat; /* number of input patterns */
|
||||
char_u **pat; /* array of input patterns */
|
||||
! int *num_files; /* resulting number of files */
|
||||
! char_u ***files; /* array of resulting files */
|
||||
int flags; /* EW_DIR, etc. */
|
||||
{
|
||||
int retval;
|
||||
***************
|
||||
*** 9712,9718 ****
|
||||
char_u *p;
|
||||
int non_suf_match; /* number without matching suffix */
|
||||
|
||||
! retval = gen_expand_wildcards(num_pat, pat, num_file, file, flags);
|
||||
|
||||
/* When keeping all matches, return here */
|
||||
if ((flags & EW_KEEPALL) || retval == FAIL)
|
||||
--- 9712,9718 ----
|
||||
char_u *p;
|
||||
int non_suf_match; /* number without matching suffix */
|
||||
|
||||
! retval = gen_expand_wildcards(num_pat, pat, num_files, files, flags);
|
||||
|
||||
/* When keeping all matches, return here */
|
||||
if ((flags & EW_KEEPALL) || retval == FAIL)
|
||||
***************
|
||||
*** 9726,9772 ****
|
||||
{
|
||||
char_u *ffname;
|
||||
|
||||
! /* check all files in (*file)[] */
|
||||
! for (i = 0; i < *num_file; ++i)
|
||||
{
|
||||
! ffname = FullName_save((*file)[i], FALSE);
|
||||
if (ffname == NULL) /* out of memory */
|
||||
break;
|
||||
# ifdef VMS
|
||||
vms_remove_version(ffname);
|
||||
# endif
|
||||
! if (match_file_list(p_wig, (*file)[i], ffname))
|
||||
{
|
||||
! /* remove this matching file from the list */
|
||||
! vim_free((*file)[i]);
|
||||
! for (j = i; j + 1 < *num_file; ++j)
|
||||
! (*file)[j] = (*file)[j + 1];
|
||||
! --*num_file;
|
||||
--i;
|
||||
}
|
||||
vim_free(ffname);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Move the names where 'suffixes' match to the end.
|
||||
*/
|
||||
! if (*num_file > 1)
|
||||
{
|
||||
non_suf_match = 0;
|
||||
! for (i = 0; i < *num_file; ++i)
|
||||
{
|
||||
! if (!match_suffix((*file)[i]))
|
||||
{
|
||||
/*
|
||||
* Move the name without matching suffix to the front
|
||||
* of the list.
|
||||
*/
|
||||
! p = (*file)[i];
|
||||
for (j = i; j > non_suf_match; --j)
|
||||
! (*file)[j] = (*file)[j - 1];
|
||||
! (*file)[non_suf_match++] = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
--- 9726,9780 ----
|
||||
{
|
||||
char_u *ffname;
|
||||
|
||||
! /* check all files in (*files)[] */
|
||||
! for (i = 0; i < *num_files; ++i)
|
||||
{
|
||||
! ffname = FullName_save((*files)[i], FALSE);
|
||||
if (ffname == NULL) /* out of memory */
|
||||
break;
|
||||
# ifdef VMS
|
||||
vms_remove_version(ffname);
|
||||
# endif
|
||||
! if (match_file_list(p_wig, (*files)[i], ffname))
|
||||
{
|
||||
! /* remove this matching files from the list */
|
||||
! vim_free((*files)[i]);
|
||||
! for (j = i; j + 1 < *num_files; ++j)
|
||||
! (*files)[j] = (*files)[j + 1];
|
||||
! --*num_files;
|
||||
--i;
|
||||
}
|
||||
vim_free(ffname);
|
||||
}
|
||||
+
|
||||
+ /* If the number of matches is now zero, we fail. */
|
||||
+ if (*num_files == 0)
|
||||
+ {
|
||||
+ vim_free(*files);
|
||||
+ *files = NULL;
|
||||
+ return FAIL;
|
||||
+ }
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Move the names where 'suffixes' match to the end.
|
||||
*/
|
||||
! if (*num_files > 1)
|
||||
{
|
||||
non_suf_match = 0;
|
||||
! for (i = 0; i < *num_files; ++i)
|
||||
{
|
||||
! if (!match_suffix((*files)[i]))
|
||||
{
|
||||
/*
|
||||
* Move the name without matching suffix to the front
|
||||
* of the list.
|
||||
*/
|
||||
! p = (*files)[i];
|
||||
for (j = i; j > non_suf_match; --j)
|
||||
! (*files)[j] = (*files)[j - 1];
|
||||
! (*files)[non_suf_match++] = p;
|
||||
}
|
||||
}
|
||||
}
|
||||
*** ../vim-7.4.870/src/version.c 2015-09-15 18:29:35.488932799 +0200
|
||||
--- src/version.c 2015-09-15 18:58:45.310768934 +0200
|
||||
***************
|
||||
*** 743,744 ****
|
||||
--- 743,746 ----
|
||||
{ /* Add new patch number below this line */
|
||||
+ /**/
|
||||
+ 871,
|
||||
/**/
|
||||
|
||||
--
|
||||
Team-building exercises come in many forms but they all trace their roots back
|
||||
to the prison system. In your typical team-building exercise the employees
|
||||
are subjected to a variety of unpleasant situations until they become either a
|
||||
cohesive team or a ring of car jackers.
|
||||
(Scott Adams - The Dilbert principle)
|
||||
|
||||
/// Bram Moolenaar -- Bram@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 ///
|
Loading…
Reference in New Issue
Block a user