aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorMichael Ennen <brcolow@users.noreply.github.com>2016-10-26 04:27:00 -0700
committerJustin M. Keyes <justinkz@gmail.com>2016-10-26 13:27:00 +0200
commite350902b7de17583e3a94fa92f736aded0726774 (patch)
tree161d60a3463d692d1dc9573eae26224279b834df /src/nvim/ex_cmds.c
parent2a6c5bb0c4b03a9da81dae64d37c9912e448eaf0 (diff)
downloadrneovim-e350902b7de17583e3a94fa92f736aded0726774.tar.gz
rneovim-e350902b7de17583e3a94fa92f736aded0726774.tar.bz2
rneovim-e350902b7de17583e3a94fa92f736aded0726774.zip
vim-patch:7.4.2128 (#5517)
Problem: Memory leak when saving for undo fails. Solution: Free allocated memory. (Hirohito Higashi) https://github.com/vim/vim/commit/1e2258297bb31720bfbeb234f2dae4d1b3b04fbd
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 6205daf0cb..96eeff8973 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -2370,10 +2370,12 @@ do_ecmd (
if (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur) {
/* Save all the text, so that the reload can be undone.
* Sync first so that this is a separate undo-able action. */
- u_sync(FALSE);
- if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE)
- == FAIL)
+ u_sync(false);
+ if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, true)
+ == FAIL) {
+ xfree(new_name);
goto theend;
+ }
u_unchanged(curbuf);
buf_freeall(curbuf, BFA_KEEP_UNDO);