Skip to content

Commit e16e5a9

Browse files
committed
patch 7.4.1406
Problem: Leaking memory in cs_print_tags_priv(). Solution: Free tbuf. (idea by Forrest Fleming)
1 parent 8aefbe0 commit e16e5a9

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/if_cscope.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,12 +2092,13 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
20922092
continue;
20932093
(void)strcpy(tbuf, matches[idx]);
20942094

2095-
if (strtok(tbuf, (const char *)"\t") == NULL)
2096-
continue;
2097-
if ((fname = strtok(NULL, (const char *)"\t")) == NULL)
2098-
continue;
2099-
if ((lno = strtok(NULL, (const char *)"\t")) == NULL)
2095+
if (strtok(tbuf, (const char *)"\t") == NULL
2096+
|| (fname = strtok(NULL, (const char *)"\t")) == NULL
2097+
|| (lno = strtok(NULL, (const char *)"\t")) == NULL)
2098+
{
2099+
vim_free(tbuf);
21002100
continue;
2101+
}
21012102
extra = strtok(NULL, (const char *)"\t");
21022103

21032104
lno[strlen(lno)-2] = '\0'; /* ignore ;" at the end */

src/version.c

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

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1406,
751753
/**/
752754
1405,
753755
/**/

0 commit comments

Comments
 (0)