Skip to content

Commit

Permalink
eval: When clearing vimvars do clear dictionaries as well
Browse files Browse the repository at this point in the history
This caused memory leak when clearing v:msgpack_types which was gone unnoticed 
until now for some weird reason.
  • Loading branch information
ZyX-I committed Feb 11, 2018
1 parent e16e4b2 commit 5d15b11
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/nvim/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,17 +614,8 @@ void eval_init(void)
#if defined(EXITFREE)
void eval_clear(void)
{
struct vimvar *p;

for (size_t i = 0; i < ARRAY_SIZE(vimvars); i++) {
p = &vimvars[i];
if (p->vv_di.di_tv.v_type == VAR_STRING) {
xfree(p->vv_str);
p->vv_str = NULL;
} else if (p->vv_di.di_tv.v_type == VAR_LIST) {
tv_list_unref(p->vv_list);
p->vv_list = NULL;
}
tv_clear(&vimvars[i].vv_di.di_tv);
}
hash_clear(&vimvarht);
hash_init(&vimvarht); /* garbage_collect() will access it */
Expand Down

0 comments on commit 5d15b11

Please sign in to comment.