diff options
author | Fabian Brosda <f.brosda@gmx.de> | 2015-02-14 16:48:53 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-02-19 17:08:43 -0500 |
commit | 0a7cd65cbce8eb7fc488fb1b37fe46783e9d6e56 (patch) | |
tree | 377e5a0805528a3b594c58789fa429ee6789cdea | |
parent | 866da6d65e5078ac5aa91af5b4e78caf07853379 (diff) | |
download | rneovim-0a7cd65cbce8eb7fc488fb1b37fe46783e9d6e56.tar.gz rneovim-0a7cd65cbce8eb7fc488fb1b37fe46783e9d6e56.tar.bz2 rneovim-0a7cd65cbce8eb7fc488fb1b37fe46783e9d6e56.zip |
vim-patch:7.4.525 #1988
Problem: map() leaks memory when there is an error in the expression.
Solution: Call clear_tv(). (Christian Brabandt)
https://code.google.com/p/vim/source/detail?r=v7-4-525
-rw-r--r-- | src/nvim/eval.c | 7 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index b06c0961c5..ab24dce472 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8575,12 +8575,12 @@ static void filter_map(typval_T *argvars, typval_T *rettv, int map) (char_u *)_(arg_errmsg))) break; vimvars[VV_KEY].vv_str = vim_strsave(di->di_key); - if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL - || did_emsg) + int r = filter_map_one(&di->di_tv, expr, map, &rem); + clear_tv(&vimvars[VV_KEY].vv_tv); + if (r == FAIL || did_emsg) break; if (!map && rem) dictitem_remove(d, di); - clear_tv(&vimvars[VV_KEY].vv_tv); } } hash_unlock(ht); @@ -8622,6 +8622,7 @@ static int filter_map_one(typval_T *tv, char_u *expr, int map, int *remp) goto theend; if (*s != NUL) { /* check for trailing chars after expr */ EMSG2(_(e_invexpr2), s); + clear_tv(&rettv); goto theend; } if (map) { diff --git a/src/nvim/version.c b/src/nvim/version.c index 02d5f66260..8abbdb8a8b 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -259,7 +259,7 @@ static int included_patches[] = { 528, 527, //526, - //525, + 525, //524, //523 NA //522 NA |