To: vim_dev@googlegroups.com Subject: Patch 7.4.1406 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1406 Problem: Leaking memory in cs_print_tags_priv(). Solution: Free tbuf. (idea by Forrest Fleming) Files: src/if_cscope.c *** ../vim-7.4.1405/src/if_cscope.c 2016-02-16 15:06:54.661635316 +0100 --- src/if_cscope.c 2016-02-23 20:41:15.027135552 +0100 *************** *** 2092,2103 **** 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) continue; extra = strtok(NULL, (const char *)"\t"); lno[strlen(lno)-2] = '\0'; /* ignore ;" at the end */ --- 2092,2104 ---- continue; (void)strcpy(tbuf, matches[idx]); ! 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 */ *** ../vim-7.4.1405/src/version.c 2016-02-23 20:13:10.172805422 +0100 --- src/version.c 2016-02-23 20:42:53.342105041 +0100 *************** *** 750,751 **** --- 750,753 ---- { /* Add new patch number below this line */ + /**/ + 1406, /**/ -- Time flies like an arrow. Fruit flies like a banana. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///