From 4f1982800f0aff28df6875e718a786f6c4b11ad9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 23 Oct 2017 21:53:30 +0200 Subject: [PATCH] patch 8.0.1214: accessing freed memory when EXITFREE is set 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 | 4 +++- src/screen.c | 2 +- src/version.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/misc2.c b/src/misc2.c index fac44c737a..52ce097a81 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -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 diff --git a/src/screen.c b/src/screen.c index 3e08b600f6..c92b17ebb5 100644 --- a/src/screen.c +++ b/src/screen.c @@ -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) diff --git a/src/version.c b/src/version.c index 160edbe45e..c8bab5d4ce 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1214, /**/ 1213, /**/