aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/syntax.c
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-11-13 23:30:43 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2014-11-15 12:49:18 +0100
commitfcd5a8643c2022f20f5225614fd5dc39775af486 (patch)
tree015354175b6bb9a920da18188a6f86254acb8ce8 /src/nvim/syntax.c
parentce9c4e9a6f253b1540a5367f834f6dd31e6db0c8 (diff)
downloadrneovim-fcd5a8643c2022f20f5225614fd5dc39775af486.tar.gz
rneovim-fcd5a8643c2022f20f5225614fd5dc39775af486.tar.bz2
rneovim-fcd5a8643c2022f20f5225614fd5dc39775af486.zip
Fix warnings: syntax.c: get_id_list(): Double free: FP.
Problem : Double free @ 5213. Diagnostic : False positive. Rationale : Suggested error path contains two consecutive invocations of `ends_excmd(*p)` having different results, which is not possible. First invocation is before the while loop. Second invocation is the while loop condition itsef. Resolution : Refactor while loop into do-while loop. That removes the impossible path from analysis, and, in addition, is a bit more efficient.
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r--src/nvim/syntax.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 4a3ab46e75..6c5c0f37b1 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5106,7 +5106,7 @@ get_id_list (
* parse the arguments after "contains"
*/
count = 0;
- while (!ends_excmd(*p)) {
+ do {
for (end = p; *end && !vim_iswhite(*end) && *end != ','; ++end)
;
name = xmalloc((int)(end - p + 3)); /* leave room for "^$" */
@@ -5199,7 +5199,7 @@ get_id_list (
if (*p != ',')
break;
p = skipwhite(p + 1); /* skip comma in between arguments */
- }
+ } while (!ends_excmd(*p));
if (failed)
break;
if (round == 1) {