Mercurial > vim
comparison src/indent.c @ 23833:dd8f2c6b6396 v8.2.2458
patch 8.2.2458: Coverity warns for :retab using freed memory
Commit: https://github.com/vim/vim/commit/0dcd39bad5e5aa70ba8f60cb3fbf0658585f0151
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 3 19:44:25 2021 +0100
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 03 Feb 2021 19:45:06 +0100 |
parents | e82579016863 |
children | 44be09b25619 |
comparison
equal
deleted
inserted
replaced
23832:17d43bc61e08 | 23833:dd8f2c6b6396 |
---|---|
1660 mch_memmove(new_line + start_col + len, | 1660 mch_memmove(new_line + start_col + len, |
1661 ptr + col, (size_t)(old_len - col + 1)); | 1661 ptr + col, (size_t)(old_len - col + 1)); |
1662 ptr = new_line + start_col; | 1662 ptr = new_line + start_col; |
1663 for (col = 0; col < len; col++) | 1663 for (col = 0; col < len; col++) |
1664 ptr[col] = (col < num_tabs) ? '\t' : ' '; | 1664 ptr[col] = (col < num_tabs) ? '\t' : ' '; |
1665 ml_replace(lnum, new_line, FALSE); | 1665 if (ml_replace(lnum, new_line, FALSE) == OK) |
1666 // "new_line" may have been copied | |
1667 new_line = curbuf->b_ml.ml_line_ptr; | |
1666 if (first_line == 0) | 1668 if (first_line == 0) |
1667 first_line = lnum; | 1669 first_line = lnum; |
1668 last_line = lnum; | 1670 last_line = lnum; |
1669 ptr = new_line; | 1671 ptr = new_line; |
1670 col = start_col + len; | 1672 col = start_col + len; |