vim-patch:8.2.2661: leaking memory when looping over a string

Problem:    Leaking memory when looping over a string.
Solution:   Free the memory.
bb5d87c850
This commit is contained in:
Sean Dewar 2022-01-01 07:51:13 +00:00
parent 7002a3433b
commit 83a48d7a44
No known key found for this signature in database
GPG Key ID: 08CC2C83AD41B581

View File

@ -2698,7 +2698,10 @@ bool next_for_item(void *fi_void, char_u *arg)
tv.v_lock = VAR_FIXED;
tv.vval.v_string = vim_strnsave(fi->fi_string + fi->fi_byte_idx, len);
fi->fi_byte_idx += len;
return ex_let_vars(arg, &tv, true, fi->fi_semicolon, fi->fi_varcount, false, NULL) == OK;
const int result
= ex_let_vars(arg, &tv, true, fi->fi_semicolon, fi->fi_varcount, false, NULL) == OK;
xfree(tv.vval.v_string);
return result;
}
listitem_T *item = fi->fi_lw.lw_item;