]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/routemap.c
lib: do not test before XFREE
[mirror_frr.git] / 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)