vim-patch:8.0.0235

Problem:    Memory leak detected when running tests for diff mode.
Solution:   Free p_extra_free.

b031c4ea04
This commit is contained in:
Justin M. Keyes 2017-08-12 18:22:47 +02:00
parent 7dc5e8fb8b
commit c87dbadc44
2 changed files with 12 additions and 11 deletions

View File

@ -2715,17 +2715,15 @@ win_line (
draw_state = WL_FOLD; draw_state = WL_FOLD;
if (fdc > 0) { if (fdc > 0) {
// Draw the 'foldcolumn'. Allocate a buffer, "extra" may // 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); p_extra_free = xmalloc(12 + 1);
fill_foldcolumn(p_extra_free, wp, false, lnum);
if (p_extra_free != NULL) { n_extra = fdc;
fill_foldcolumn(p_extra_free, wp, false, lnum); p_extra_free[n_extra] = NUL;
n_extra = fdc; p_extra = p_extra_free;
p_extra_free[n_extra] = NUL; c_extra = NUL;
p_extra = p_extra_free; char_attr = win_hl_attr(wp, HLF_FC);
c_extra = NUL;
char_attr = win_hl_attr(wp, HLF_FC);
}
} }
} }
@ -3526,6 +3524,7 @@ win_line (
p = xmalloc(len + 1); p = xmalloc(len + 1);
memset(p, ' ', len); memset(p, ' ', len);
p[len] = NUL; p[len] = NUL;
xfree(p_extra_free);
p_extra_free = p; p_extra_free = p;
for (i = 0; i < tab_len; i++) { for (i = 0; i < tab_len; i++) {
mb_char2bytes(lcs_tab2, p); mb_char2bytes(lcs_tab2, p);
@ -3641,6 +3640,7 @@ win_line (
memset(p, ' ', n_extra); memset(p, ' ', n_extra);
STRNCPY(p, p_extra + 1, STRLEN(p_extra) - 1); STRNCPY(p, p_extra + 1, STRLEN(p_extra) - 1);
p[n_extra] = NUL; p[n_extra] = NUL;
xfree(p_extra_free);
p_extra_free = p_extra = p; p_extra_free = p_extra = p;
} else { } else {
n_extra = byte2cells(c) - 1; n_extra = byte2cells(c) - 1;
@ -4314,6 +4314,7 @@ win_line (
cap_col = 0; cap_col = 0;
} }
xfree(p_extra_free);
return row; return row;
} }

View File

@ -717,7 +717,7 @@ static const int included_patches[] = {
// 238, // 238,
// 237, // 237,
// 236, // 236,
// 235, 235,
// 234, // 234,
// 233, // 233,
// 232 NA // 232 NA