aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-12-17 19:54:25 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2014-12-17 22:10:14 +0100
commit885661d25b11aa248e3841953264d5cd92486991 (patch)
tree2560315c7b0e6a605b04bebb8f5258ea2afe29a3
parent693da009204f058494ef32dc5ce5c5d4298a61d6 (diff)
downloadrneovim-885661d25b11aa248e3841953264d5cd92486991.tar.gz
rneovim-885661d25b11aa248e3841953264d5cd92486991.tar.bz2
rneovim-885661d25b11aa248e3841953264d5cd92486991.zip
Fix warnings: syntax.c: get_id_list(): Double free: FP.
Problem : Double free @ 5213. Diagnostic : False positive. Rationale : I haven't been able to find the real reason why this is signaled. Nonetheless, I've been able to track down the introduction of this warning to commit 77135447e09903b45d1482da45869946212f7904. The change there affecting this function is just a transformation maintaining semantics. So, this must be a FP, though I can't explain why. Resolution : Revert changes in mentioned commmit touching this function.
-rw-r--r--src/nvim/syntax.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index b7a485598b..3deda0a8c9 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5157,22 +5157,21 @@ get_id_list (
regmatch.rm_ic = TRUE;
id = 0;
for (int i = highlight_ga.ga_len; --i >= 0; ) {
- if (!vim_regexec(&regmatch, HL_TABLE()[i].sg_name, (colnr_T)0)) {
- continue;
- }
- if (round == 2) {
- /* Got more items than expected; can happen
- * when adding items that match:
- * "contains=a.*b,axb".
- * Go back to first round */
- if (count >= total_count) {
- free(retval);
- round = 1;
- } else
- retval[count] = i + 1;
+ if (vim_regexec(&regmatch, HL_TABLE()[i].sg_name, (colnr_T)0)) {
+ if (round == 2) {
+ /* Got more items than expected; can happen
+ * when adding items that match:
+ * "contains=a.*b,axb".
+ * Go back to first round */
+ if (count >= total_count) {
+ free(retval);
+ round = 1;
+ } else
+ retval[count] = i + 1;
+ }
+ ++count;
+ id = -1; /* remember that we found one */
}
- ++count;
- id = -1; /* remember that we found one */
}
vim_regfree(regmatch.regprog);
}