diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-23 20:44:08 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-23 20:44:08 +0100 |
commit | e16e5a9d8d6d3159107541a259c6823ade18fd08 (patch) | |
tree | 973d7a3d9f58937ec57a7ca4c5b29dc39b17f945 /src/if_cscope.c | |
parent | 8aefbe0ad5d05ee7225b20024b0f3023286ebd0f (diff) | |
download | vim-git-e16e5a9d8d6d3159107541a259c6823ade18fd08.tar.gz |
patch 7.4.1406v7.4.1406
Problem: Leaking memory in cs_print_tags_priv().
Solution: Free tbuf. (idea by Forrest Fleming)
Diffstat (limited to 'src/if_cscope.c')
-rw-r--r-- | src/if_cscope.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/if_cscope.c b/src/if_cscope.c index c135fe5bb..b5ca6148b 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -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 */ |