From: Rafael Zalamena Date: Wed, 19 Feb 2020 13:35:28 +0000 (-0300) Subject: lib: fix route-map coverity scan issue X-Git-Tag: base_7.4~334^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=1c4eca648cb91d4aeb3dcbff6b11197285250389;p=matthieu%2Ffrr.git lib: fix route-map coverity scan issue Use better TAILQ free idiom to avoid coverity scan warnings. This fixes the coverity scan issue 1491240 . Signed-off-by: Rafael Zalamena --- diff --git a/lib/routemap.c b/lib/routemap.c index 0d5621d90e..e214aa43b7 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -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)