summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-08-25 08:07:58 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-08-25 11:37:07 -0400
commit1e9f448fe1b60e464d187c96092d2cf6201e64e1 (patch)
tree381ed303a9f00d6534be36b2e5671f6b4ed656e6 /zebra/zebra_rib.c
parent9ca25fedba875265f191af92f1887d35076b6403 (diff)
zebra: Coverity Code Cleanup
1) Various socket close issues 2) Ensure afi passed is usable 3) Fix some reads beyond buffer and reads after free 4) Ensure some failure modes are handled properly 5) Memory Leak(s) fix 6) There is no 6. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index dc61ea5e40..63ac06b160 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2745,23 +2745,27 @@ unsigned long rib_score_proto(u_char proto, u_short instance)
void rib_close_table(struct route_table *table)
{
struct route_node *rn;
- rib_table_info_t *info = table->info;
+ rib_table_info_t *info;
struct route_entry *re;
- if (table)
- for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
- RNODE_FOREACH_RE(rn, re)
- {
- if (!CHECK_FLAG(re->status,
- ROUTE_ENTRY_SELECTED_FIB))
- continue;
+ if (!table)
+ return;
- if (info->safi == SAFI_UNICAST)
- hook_call(rib_update, rn, NULL);
+ info = table->info;
- if (!RIB_SYSTEM_ROUTE(re))
- rib_uninstall_kernel(rn, re);
- }
+ for (rn = route_top(table); rn; rn = srcdest_route_next(rn))
+ RNODE_FOREACH_RE(rn, re)
+ {
+ if (!CHECK_FLAG(re->status,
+ ROUTE_ENTRY_SELECTED_FIB))
+ continue;
+
+ if (info->safi == SAFI_UNICAST)
+ hook_call(rib_update, rn, NULL);
+
+ if (!RIB_SYSTEM_ROUTE(re))
+ rib_uninstall_kernel(rn, re);
+ }
}
/* Routing information base initialize. */