summaryrefslogtreecommitdiff
path: root/zebra
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-11-16 00:00:00 +0300
committerIgor Ryzhov <iryzhov@nfware.com>2021-11-16 12:42:32 +0300
commit9742796ff1b34699297b64c72b31a27fbafd23b0 (patch)
tree2e91d827eab21a8f3cff4da6c5233f316e749b95 /zebra
parentde48804c01e077a54b4a46221c433c33abc4e334 (diff)
zebra: fix memleak on shutdown
During shutdown, when table_manager_disable is called for the default VRF, its vrf_id is already set to VRF_UNKNOWN, so the expression is true and the table manager memory is not freed. Change the expression to compare the VRF name instead of the id. The check in table_manager_enable is changed for consistency. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/table_manager.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/zebra/table_manager.c b/zebra/table_manager.c
index 82d6a0a6a2..ffc7a48eb9 100644
--- a/zebra/table_manager.c
+++ b/zebra/table_manager.c
@@ -72,7 +72,8 @@ void table_manager_enable(struct zebra_vrf *zvrf)
if (zvrf->tbl_mgr)
return;
- if (!vrf_is_backend_netns() && zvrf_id(zvrf) != VRF_DEFAULT) {
+ if (!vrf_is_backend_netns()
+ && strcmp(zvrf_name(zvrf), VRF_DEFAULT_NAME)) {
struct zebra_vrf *def = zebra_vrf_lookup_by_id(VRF_DEFAULT);
if (def)
@@ -284,7 +285,8 @@ void table_manager_disable(struct zebra_vrf *zvrf)
{
if (!zvrf->tbl_mgr)
return;
- if (!vrf_is_backend_netns() && zvrf_id(zvrf) != VRF_DEFAULT) {
+ if (!vrf_is_backend_netns()
+ && strcmp(zvrf_name(zvrf), VRF_DEFAULT_NAME)) {
zvrf->tbl_mgr = NULL;
return;
}