changeset 4327:0d3573091d42 v7.3.913

updated for version 7.3.913 Problem: Still a crash when writing viminfo. Solution: Add checks for NULL pointers. (Ron Aaron)
author Bram Moolenaar <bram@vim.org>
date Wed, 24 Apr 2013 15:39:11 +0200
parents e75073cc86f3
children 6adebed70c25
files src/ex_getln.c src/version.c
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -6177,6 +6177,7 @@ finish_viminfo_history()
 	}
 	vim_free(viminfo_history[type]);
 	viminfo_history[type] = NULL;
+	viminfo_hisidx[type] = 0;
     }
 }
 
@@ -6230,6 +6231,7 @@ write_viminfo_history(fp)
 			&& !(round == 2 && i >= viminfo_hisidx[type]))
 		{
 		    p = round == 1 ? history[type][i].hisstr
+				   : viminfo_history[type] == NULL ? NULL
 						   : viminfo_history[type][i];
 		    if (p != NULL && (round == 2 || !history[type][i].viminfo))
 		    {
@@ -6261,7 +6263,8 @@ write_viminfo_history(fp)
 		}
 	}
 	for (i = 0; i < viminfo_hisidx[type]; ++i)
-	    vim_free(viminfo_history[type][i]);
+	    if (viminfo_history[type] != NULL)
+		vim_free(viminfo_history[type][i]);
 	vim_free(viminfo_history[type]);
 	viminfo_history[type] = NULL;
 	viminfo_hisidx[type] = 0;
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    913,
+/**/
     912,
 /**/
     911,