Mercurial > vim
changeset 8226:cb0edf7bd0a4 v7.4.1406
commit https://github.com/vim/vim/commit/e16e5a9d8d6d3159107541a259c6823ade18fd08
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 23 20:44:08 2016 +0100
patch 7.4.1406
Problem: Leaking memory in cs_print_tags_priv().
Solution: Free tbuf. (idea by Forrest Fleming)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 23 Feb 2016 20:45:05 +0100 |
parents | 1d89a5001f9f |
children | f26bb0f9a8b9 |
files | src/if_cscope.c src/version.c |
diffstat | 2 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -2092,12 +2092,13 @@ cs_print_tags_priv(char **matches, char continue; (void)strcpy(tbuf, matches[idx]); - if (strtok(tbuf, (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; - 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 */