]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: fix route-map coverity scan issue
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 19 Feb 2020 13:35:28 +0000 (10:35 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Wed, 19 Feb 2020 13:35:28 +0000 (10:35 -0300)
Use better TAILQ free idiom to avoid coverity scan warnings. This fixes
the coverity scan issue 1491240 .

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
lib/routemap.c

index 0d5621d90e353a84fd9eebd18640b03b06c66328..e214aa43b7a37b33cee7cda0a4af0ae1b2e4295b 100644 (file)
@@ -914,6 +914,7 @@ static struct route_map_index *route_map_index_new(void)
 /* Free route map index. */
 void route_map_index_delete(struct route_map_index *index, int notify)
 {
+       struct routemap_hook_context *rhc;
        struct route_map_rule *rule;
 
        QOBJ_UNREG(index);
@@ -923,8 +924,8 @@ void route_map_index_delete(struct route_map_index *index, int notify)
                           index->map->name, index->pref);
 
        /* Free route map northbound hook contexts. */
-       while (!TAILQ_EMPTY(&index->rhclist))
-               routemap_hook_context_free(TAILQ_FIRST(&index->rhclist));
+       while ((rhc = TAILQ_FIRST(&index->rhclist)) != NULL)
+               routemap_hook_context_free(rhc);
 
        /* Free route match. */
        while ((rule = index->match_list.head) != NULL)