components/vim/vim72-patches/7.2.153
changeset 198 172fc01ce997
equal deleted inserted replaced
197:fd801ec0737c 198:172fc01ce997
       
     1 To: [email protected]
       
     2 Subject: Patch 7.2.153
       
     3 Fcc: outbox
       
     4 From: Bram Moolenaar <[email protected]>
       
     5 Mime-Version: 1.0
       
     6 Content-Type: text/plain; charset=ISO-8859-1
       
     7 Content-Transfer-Encoding: 8bit
       
     8 ------------
       
     9 
       
    10 Patch 7.2.153
       
    11 Problem:    Memory leak for ":recover empty_dir/".
       
    12 Solution:   Free files[] when it becomes empty. (Dominique Pelle)
       
    13 Files:	    src/memline.c
       
    14 
       
    15 
       
    16 *** ../vim-7.2.152/src/memline.c	Sun Jul 13 19:40:43 2008
       
    17 --- src/memline.c	Wed Apr 22 11:48:35 2009
       
    18 ***************
       
    19 *** 1554,1563 ****
       
    20   	    for (i = 0; i < num_files; ++i)
       
    21   		if (fullpathcmp(p, files[i], TRUE) & FPC_SAME)
       
    22   		{
       
    23   		    vim_free(files[i]);
       
    24 ! 		    --num_files;
       
    25 ! 		    for ( ; i < num_files; ++i)
       
    26 ! 			files[i] = files[i + 1];
       
    27   		}
       
    28   	}
       
    29   	if (nr > 0)
       
    30 --- 1554,1568 ----
       
    31   	    for (i = 0; i < num_files; ++i)
       
    32   		if (fullpathcmp(p, files[i], TRUE) & FPC_SAME)
       
    33   		{
       
    34 + 		    /* Remove the name from files[i].  Move further entries
       
    35 + 		     * down.  When the array becomes empty free it here, since
       
    36 + 		     * FreeWild() won't be called below. */
       
    37   		    vim_free(files[i]);
       
    38 ! 		    if (--num_files == 0)
       
    39 ! 			vim_free(files);
       
    40 ! 		    else
       
    41 ! 			for ( ; i < num_files; ++i)
       
    42 ! 			    files[i] = files[i + 1];
       
    43   		}
       
    44   	}
       
    45   	if (nr > 0)
       
    46 ***************
       
    47 *** 3522,3528 ****
       
    48   	    if (errno == EINVAL || errno == ENOENT)
       
    49   	    {
       
    50   		/* Found non-symlink or not existing file, stop here.
       
    51 ! 		 * When at the first level use the unmodifed name, skip the
       
    52   		 * call to vim_FullName(). */
       
    53   		if (depth == 1)
       
    54   		    return FAIL;
       
    55 --- 3527,3533 ----
       
    56   	    if (errno == EINVAL || errno == ENOENT)
       
    57   	    {
       
    58   		/* Found non-symlink or not existing file, stop here.
       
    59 ! 		 * When at the first level use the unmodified name, skip the
       
    60   		 * call to vim_FullName(). */
       
    61   		if (depth == 1)
       
    62   		    return FAIL;
       
    63 ***************
       
    64 *** 4560,4566 ****
       
    65   			buf->b_ml.ml_chunksize + curix,
       
    66   			(buf->b_ml.ml_usedchunks - curix) *
       
    67   			sizeof(chunksize_T));
       
    68 ! 	    /* Compute length of first half of lines in the splitted chunk */
       
    69   	    size = 0;
       
    70   	    linecnt = 0;
       
    71   	    while (curline < buf->b_ml.ml_line_count
       
    72 --- 4568,4574 ----
       
    73   			buf->b_ml.ml_chunksize + curix,
       
    74   			(buf->b_ml.ml_usedchunks - curix) *
       
    75   			sizeof(chunksize_T));
       
    76 ! 	    /* Compute length of first half of lines in the split chunk */
       
    77   	    size = 0;
       
    78   	    linecnt = 0;
       
    79   	    while (curline < buf->b_ml.ml_line_count
       
    80 *** ../vim-7.2.152/src/version.c	Wed Apr 22 14:42:26 2009
       
    81 --- src/version.c	Wed Apr 22 15:34:18 2009
       
    82 ***************
       
    83 *** 678,679 ****
       
    84 --- 678,681 ----
       
    85   {   /* Add new patch number below this line */
       
    86 + /**/
       
    87 +     153,
       
    88   /**/
       
    89 
       
    90 -- 
       
    91 Windows
       
    92 M!uqoms
       
    93 
       
    94  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
       
    95 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
       
    96 \\\        download, build and distribute -- http://www.A-A-P.org        ///
       
    97  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///