diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-08-12 18:22:47 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-08-12 18:28:38 +0200 |
commit | c87dbadc44f7d3705c7cf4e4dc7345da33f63e1a (patch) | |
tree | f12cdcda2c79c9daf908813fa2c2ec292bd2c2e5 | |
parent | 7dc5e8fb8b9265dcb97e8fe4c7c6ee902be33614 (diff) | |
download | rneovim-c87dbadc44f7d3705c7cf4e4dc7345da33f63e1a.tar.gz rneovim-c87dbadc44f7d3705c7cf4e4dc7345da33f63e1a.tar.bz2 rneovim-c87dbadc44f7d3705c7cf4e4dc7345da33f63e1a.zip |
vim-patch:8.0.0235
Problem: Memory leak detected when running tests for diff mode.
Solution: Free p_extra_free.
https://github.com/vim/vim/commit/b031c4ea04eb1e37a873fbb85e90d835aa1e2b1c
-rw-r--r-- | src/nvim/screen.c | 21 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index dd958eec80..f8d519ab36 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2715,17 +2715,15 @@ win_line ( draw_state = WL_FOLD; if (fdc > 0) { // Draw the 'foldcolumn'. Allocate a buffer, "extra" may - // already be in used. + // already be in use. + xfree(p_extra_free); p_extra_free = xmalloc(12 + 1); - - if (p_extra_free != NULL) { - fill_foldcolumn(p_extra_free, wp, false, lnum); - n_extra = fdc; - p_extra_free[n_extra] = NUL; - p_extra = p_extra_free; - c_extra = NUL; - char_attr = win_hl_attr(wp, HLF_FC); - } + fill_foldcolumn(p_extra_free, wp, false, lnum); + n_extra = fdc; + p_extra_free[n_extra] = NUL; + p_extra = p_extra_free; + c_extra = NUL; + char_attr = win_hl_attr(wp, HLF_FC); } } @@ -3526,6 +3524,7 @@ win_line ( p = xmalloc(len + 1); memset(p, ' ', len); p[len] = NUL; + xfree(p_extra_free); p_extra_free = p; for (i = 0; i < tab_len; i++) { mb_char2bytes(lcs_tab2, p); @@ -3641,6 +3640,7 @@ win_line ( memset(p, ' ', n_extra); STRNCPY(p, p_extra + 1, STRLEN(p_extra) - 1); p[n_extra] = NUL; + xfree(p_extra_free); p_extra_free = p_extra = p; } else { n_extra = byte2cells(c) - 1; @@ -4314,6 +4314,7 @@ win_line ( cap_col = 0; } + xfree(p_extra_free); return row; } diff --git a/src/nvim/version.c b/src/nvim/version.c index a1655f1caa..f4984864f3 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -717,7 +717,7 @@ static const int included_patches[] = { // 238, // 237, // 236, - // 235, + 235, // 234, // 233, // 232 NA |