diff src/terminal.c @ 15828:8f112782a2e9 v8.1.0921

patch 8.1.0921: terminal test sometimes fails; using memory after free commit https://github.com/vim/vim/commit/81aa0f56f8be6922730f1ca368d6c64661dc97a3 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 14 23:23:19 2019 +0100 patch 8.1.0921: terminal test sometimes fails; using memory after free Problem: Terminal test sometimes fails; using memory after free. Solution: Fee memory a bit later. Add test to cover this. Disable flaky screenshot test. (closes #3956)
author Bram Moolenaar <Bram@vim.org>
date Thu, 14 Feb 2019 23:30:05 +0100
parents 1f2edc01e7ed
children 85c94163c4ab
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -4735,7 +4735,6 @@ term_load_dump(typval_T *argvars, typval
 		    p2 += len2;
 		    /* TODO: handle different width */
 		}
-		vim_free(line1);
 
 		while (col < width)
 		{
@@ -4753,6 +4752,8 @@ term_load_dump(typval_T *argvars, typval
 		    }
 		    ++col;
 		}
+
+		vim_free(line1);
 	    }
 	    if (add_empty_scrollback(term, &term->tl_default_color,
 						 term->tl_top_diff_rows) == OK)