updated for version 7.0108
diff --git a/src/undo.c b/src/undo.c
index 53070af..362b317 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -656,6 +656,8 @@
 		ml_delete(lnum, FALSE);
 	    }
 	}
+	else
+	    newarray = NULL;
 
 	/* insert the lines in u_array between top and bot */
 	if (newsize)
@@ -923,7 +925,7 @@
     u_entry_T	*uep;
     long	    n;
 {
-    while (n)
+    while (n > 0)
 	U_FREE_LINE(uep->ue_array[--n]);
     U_FREE_LINE((char_u *)uep->ue_array);
     U_FREE_LINE((char_u *)uep);