Skip to content

Commit bb5d87c

Browse files
committed
patch 8.2.2661: leaking memory when looping over a string
Problem: Leaking memory when looping over a string. Solution: Free the memory.
1 parent ccc25aa commit bb5d87c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/eval.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1815,8 +1815,10 @@ next_for_item(void *fi_void, char_u *arg)
18151815
tv.v_lock = VAR_FIXED;
18161816
tv.vval.v_string = vim_strnsave(fi->fi_string + fi->fi_byte_idx, len);
18171817
fi->fi_byte_idx += len;
1818-
return ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon,
1818+
result = ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon,
18191819
fi->fi_varcount, flag, NULL) == OK;
1820+
vim_free(tv.vval.v_string);
1821+
return result;
18201822
}
18211823

18221824
item = fi->fi_lw.lw_item;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2661,
753755
/**/
754756
2660,
755757
/**/

0 commit comments

Comments
 (0)