aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-03 18:28:03 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-03 18:33:52 -0500
commit8d3baf07910b15a57119fe063bee67ec07d57efa (patch)
tree001314804d7d1ea5dfa01b107f050e155d50044e /src
parent65e51fca0e48a6ffe62902a56b417f120b0f11f7 (diff)
downloadrneovim-8d3baf07910b15a57119fe063bee67ec07d57efa.tar.gz
rneovim-8d3baf07910b15a57119fe063bee67ec07d57efa.tar.bz2
rneovim-8d3baf07910b15a57119fe063bee67ec07d57efa.zip
vim-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. https://github.com/vim/vim/commit/0dcd39bad5e5aa70ba8f60cb3fbf0658585f0151 N/A patches for version.c: vim-patch:8.2.2457: Coverity warns for memory leak Problem: Coverity warns for memory leak. Solution: Free memory when out of memory. https://github.com/vim/vim/commit/4dba04256b8a49b201d685217d3d7abc4988f090
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_cmds.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 2da8c205c1..6b96c4deca 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -790,7 +790,10 @@ void ex_retab(exarg_T *eap)
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;
}