Skip to content

Commit b901456

Browse files
huanghuihui0904chrisbra
authored andcommitted
patch 9.2.0258: memory leak in add_mark()
Problem: memory leak in add_mark() Solution: Free lpos in the error case when it hasn't been added to the dict yet (Huihui Huang) closes: #19827 Signed-off-by: Huihui Huang <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 02abcf3 commit b901456

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/mark.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,11 @@ add_mark(list_T *l, char_u *mname, pos_T *pos, int bufnr, char_u *fname)
14841484
if (dict_add_string(d, "mark", mname) == FAIL
14851485
|| dict_add_list(d, "pos", lpos) == FAIL
14861486
|| (fname != NULL && dict_add_string(d, "file", fname) == FAIL))
1487+
{
1488+
if (lpos->lv_refcount == 0)
1489+
list_free(lpos);
14871490
return FAIL;
1491+
}
14881492

14891493
return OK;
14901494
}

src/version.c

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

735735
static int included_patches[] =
736736
{ /* Add new patch number below this line */
737+
/**/
738+
258,
737739
/**/
738740
257,
739741
/**/

0 commit comments

Comments
 (0)