]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1406 v7.4.1406
authorBram Moolenaar <Bram@vim.org>
Tue, 23 Feb 2016 19:44:08 +0000 (20:44 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 23 Feb 2016 19:44:08 +0000 (20:44 +0100)
Problem:    Leaking memory in cs_print_tags_priv().
Solution:   Free tbuf. (idea by Forrest Fleming)

src/if_cscope.c
src/version.c

index c135fe5bbcf8d913a5c9d425a643375a8e4ae50e..b5ca6148b9599622ad30824be8527f245a528022 100644 (file)
@@ -2092,12 +2092,13 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
            continue;
        (void)strcpy(tbuf, matches[idx]);
 
-       if (strtok(tbuf, (const char *)"\t") == NULL)
-           continue;
-       if ((fname = strtok(NULL, (const char *)"\t")) == NULL)
-           continue;
-       if ((lno = strtok(NULL, (const char *)"\t")) == NULL)
+       if (strtok(tbuf, (const char *)"\t") == NULL
+               || (fname = strtok(NULL, (const char *)"\t")) == NULL
+               || (lno = strtok(NULL, (const char *)"\t")) == NULL)
+       {
+           vim_free(tbuf);
            continue;
+       }
        extra = strtok(NULL, (const char *)"\t");
 
        lno[strlen(lno)-2] = '\0';  /* ignore ;" at the end */
index 5696dfc4b837c4634fd257246603d1c2dc371c4f..a04a948c668947aa3066f34a5f95094ff804a6bc 100644 (file)
@@ -748,6 +748,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1406,
 /**/
     1405,
 /**/