0
0
mirror of https://github.com/vim/vim.git synced 2025-07-24 10:45:12 -04:00

patch 8.0.0235: memory leak in diff mode

Problem:    Memory leak detected when running tests for diff mode.
Solution:   Free p_extra_free.
This commit is contained in:
Bram Moolenaar 2017-01-24 20:14:48 +01:00
parent 941c12da3c
commit b031c4ea04
2 changed files with 6 additions and 0 deletions

View File

@ -3651,6 +3651,7 @@ win_line(
{ {
/* Draw the 'foldcolumn'. Allocate a buffer, "extra" may /* Draw the 'foldcolumn'. Allocate a buffer, "extra" may
* already be in use. */ * already be in use. */
vim_free(p_extra_free);
p_extra_free = alloc(12 + 1); p_extra_free = alloc(12 + 1);
if (p_extra_free != NULL) if (p_extra_free != NULL)
@ -4695,6 +4696,7 @@ win_line(
p = alloc((unsigned)(len + 1)); p = alloc((unsigned)(len + 1));
vim_memset(p, ' ', len); vim_memset(p, ' ', len);
p[len] = NUL; p[len] = NUL;
vim_free(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++)
{ {
@ -4857,6 +4859,7 @@ win_line(
vim_memset(p, ' ', n_extra); vim_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;
vim_free(p_extra_free);
p_extra_free = p_extra = p; p_extra_free = p_extra = p;
} }
else else
@ -5784,6 +5787,7 @@ win_line(
} }
#endif #endif
vim_free(p_extra_free);
return row; return row;
} }

View File

@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
235,
/**/ /**/
234, 234,
/**/ /**/