diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/autocmd.c | 6 | ||||
-rw-r--r-- | src/dict.c | 6 | ||||
-rw-r--r-- | src/filepath.c | 1 | ||||
-rw-r--r-- | src/map.c | 3 | ||||
-rw-r--r-- | src/option.c | 3 | ||||
-rw-r--r-- | src/testdir/test_listdict.vim | 6 | ||||
-rw-r--r-- | src/version.c | 2 |
7 files changed, 27 insertions, 0 deletions
diff --git a/src/autocmd.c b/src/autocmd.c index 666cf45d30..bce57cb759 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -3406,7 +3406,10 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv) event_dict = dict_alloc(); if (event_dict == NULL || list_append_dict(event_list, event_dict) == FAIL) + { + vim_free(pat); return; + } if (dict_add_string(event_dict, "event", event_name) == FAIL || dict_add_string(event_dict, "group", @@ -3421,7 +3424,10 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv) || dict_add_bool(event_dict, "once", ac->once) == FAIL || dict_add_bool(event_dict, "nested", ac->nested) == FAIL) + { + vim_free(pat); return; + } } } } diff --git a/src/dict.c b/src/dict.c index 508d00cdf7..c78995d80e 100644 --- a/src/dict.c +++ b/src/dict.c @@ -1300,12 +1300,18 @@ dict_extend_func( action = tv_get_string_chk(&argvars[2]); if (action == NULL) + { + if (is_new) + dict_unref(d1); return; + } for (i = 0; i < 3; ++i) if (STRCMP(action, av[i]) == 0) break; if (i == 3) { + if (is_new) + dict_unref(d1); semsg(_(e_invalid_argument_str), action); return; } diff --git a/src/filepath.c b/src/filepath.c index cbf2da4136..3bf8a2d269 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -2110,6 +2110,7 @@ f_resolve(typval_T *argvars, typval_T *rettv) if (buf == NULL) { vim_free(p); + vim_free(remain); goto fail; } @@ -2574,7 +2574,10 @@ f_maplist(typval_T *argvars UNUSED, typval_T *rettv) if ((d = dict_alloc()) == NULL) return; if (list_append_dict(rettv->vval.v_list, d) == FAIL) + { + dict_unref(d); return; + } keys_buf = NULL; did_simplify = FALSE; diff --git a/src/option.c b/src/option.c index f0fca6f45c..1bb9e29bae 100644 --- a/src/option.c +++ b/src/option.c @@ -853,7 +853,10 @@ set_string_default_esc(char *name, char_u *val, int escape) opt_idx = findoption((char_u *)name); if (opt_idx < 0) + { + vim_free(p); return; + } if (options[opt_idx].flags & P_DEF_ALLOCED) vim_free(options[opt_idx].def_val[VI_DEFAULT]); diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim index 8b2c27a89f..4c69476362 100644 --- a/src/testdir/test_listdict.vim +++ b/src/testdir/test_listdict.vim @@ -1530,4 +1530,10 @@ func Test_indexof() delfunc TestIdx endfunc +func Test_extendnew_leak() + " This used to leak memory + for i in range(100) | silent! call extendnew([], [], []) | endfor + for i in range(100) | silent! call extendnew({}, {}, {}) | endfor +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index 56c779e167..ba64d8fe17 100644 --- a/src/version.c +++ b/src/version.c @@ -705,6 +705,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 341, +/**/ 340, /**/ 339, |