Mercurial > vim
comparison src/if_cscope.c @ 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 | b6cb94ad97a4 |
children | dc72f4a463e4 |
comparison
equal
deleted
inserted
replaced
8225:1d89a5001f9f | 8226:cb0edf7bd0a4 |
---|---|
2090 */ | 2090 */ |
2091 if ((tbuf = (char *)alloc((unsigned)strlen(matches[idx]) + 1)) == NULL) | 2091 if ((tbuf = (char *)alloc((unsigned)strlen(matches[idx]) + 1)) == NULL) |
2092 continue; | 2092 continue; |
2093 (void)strcpy(tbuf, matches[idx]); | 2093 (void)strcpy(tbuf, matches[idx]); |
2094 | 2094 |
2095 if (strtok(tbuf, (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); | |
2096 continue; | 2100 continue; |
2097 if ((fname = strtok(NULL, (const char *)"\t")) == NULL) | 2101 } |
2098 continue; | |
2099 if ((lno = strtok(NULL, (const char *)"\t")) == NULL) | |
2100 continue; | |
2101 extra = strtok(NULL, (const char *)"\t"); | 2102 extra = strtok(NULL, (const char *)"\t"); |
2102 | 2103 |
2103 lno[strlen(lno)-2] = '\0'; /* ignore ;" at the end */ | 2104 lno[strlen(lno)-2] = '\0'; /* ignore ;" at the end */ |
2104 | 2105 |
2105 /* hopefully 'num' (num of matches) will be less than 10^16 */ | 2106 /* hopefully 'num' (num of matches) will be less than 10^16 */ |