0
0
mirror of https://github.com/vim/vim.git synced 2025-09-30 04:44:14 -04:00

patch 8.2.2458: Coverity warns for :retab using freed memory

Problem:    Coverity warns for :retab using freed memory.
Solution:   Use the updated line pointer when moving text properties.
This commit is contained in:
Bram Moolenaar
2021-02-03 19:44:25 +01:00
parent 4dba04256b
commit 0dcd39bad5
2 changed files with 5 additions and 1 deletions

View File

@@ -1662,7 +1662,9 @@ ex_retab(exarg_T *eap)
ptr = new_line + start_col;
for (col = 0; col < len; col++)
ptr[col] = (col < num_tabs) ? '\t' : ' ';
ml_replace(lnum, new_line, FALSE);
if (ml_replace(lnum, new_line, FALSE) == OK)
// "new_line" may have been copied
new_line = curbuf->b_ml.ml_line_ptr;
if (first_line == 0)
first_line = lnum;
last_line = lnum;

View File

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