]> granicus.if.org Git - vim/commitdiff
patch 8.0.1214: accessing freed memory when EXITFREE is set v8.0.1214
authorBram Moolenaar <Bram@vim.org>
Mon, 23 Oct 2017 19:53:30 +0000 (21:53 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 23 Oct 2017 19:53:30 +0000 (21:53 +0200)
Problem:    Accessing freed memory when EXITFREE is set and there is more than
            one tab and window. (Dominique Pelle)
Solution:   Free options later.  Skip redraw when exiting.

src/misc2.c
src/screen.c
src/version.c

index fac44c737a30c43f9eece04f24c6f16fa9e204c1..52ce097a81ad9db5bb06de1adf2061acf6d53dbf 100644 (file)
@@ -1135,7 +1135,6 @@ free_all_mem(void)
     free_all_autocmds();
 # endif
     clear_termcodes();
-    free_all_options();
     free_all_marks();
     alist_clear(&global_alist);
     free_homedir();
@@ -1196,6 +1195,9 @@ free_all_mem(void)
     /* Destroy all windows.  Must come before freeing buffers. */
     win_free_all();
 
+    /* Free all option values.  Must come after closing windows. */
+    free_all_options();
+
     /* Free all buffers.  Reset 'autochdir' to avoid accessing things that
      * were freed already. */
 #ifdef FEAT_AUTOCHDIR
index 3e08b600f69e1126c1777b0edc926bd7d4fe3bc1..c92b17ebb5c08e9d50dda61855a41bd878bac0b5 100644 (file)
@@ -203,7 +203,7 @@ redraw_win_later(
     win_T      *wp,
     int                type)
 {
-    if (wp->w_redr_type < type)
+    if (!exiting && wp->w_redr_type < type)
     {
        wp->w_redr_type = type;
        if (type >= NOT_VALID)
index 160edbe45eaa6fb983a7524bcf03f9315eeca0c2..c8bab5d4cebd0cef221b20923f6b4b03b52c0bfb 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1214,
 /**/
     1213,
 /**/