Skip to content

Commit a893194

Browse files
committed
patch 8.1.2095: leaking memory when getting item from dict
Problem: Leaking memory when getting item from dict. Solution: Also free the key when not evaluating.
1 parent 473952e commit a893194

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/dict.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,6 @@ dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, int literal)
822822
goto failret;
823823
}
824824
item = dictitem_alloc(key);
825-
clear_tv(&tvkey);
826825
if (item != NULL)
827826
{
828827
item->di_tv = tv;
@@ -831,6 +830,7 @@ dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, int literal)
831830
dictitem_free(item);
832831
}
833832
}
833+
clear_tv(&tvkey);
834834

835835
if (**arg == '}')
836836
break;

src/version.c

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

758758
static int included_patches[] =
759759
{ /* Add new patch number below this line */
760+
/**/
761+
2095,
760762
/**/
761763
2094,
762764
/**/

0 commit comments

Comments
 (0)