diff --git a/zebra/zebra_evpn.c b/zebra/zebra_evpn.c index 168f0b2ce69e..353616608423 100644 --- a/zebra/zebra_evpn.c +++ b/zebra/zebra_evpn.c @@ -1019,6 +1019,8 @@ struct zebra_evpn *zebra_evpn_add(vni_t vni) zvrf = zebra_vrf_get_evpn(); memset(&tmp_zevpn, 0, sizeof(tmp_zevpn)); tmp_zevpn.vni = vni; + if (!zvrf->evpn_table) + return NULL; zevpn = hash_get(zvrf->evpn_table, &tmp_zevpn, zebra_evpn_alloc); zebra_evpn_es_evi_init(zevpn); diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 34cce71cd75d..90e73af084b6 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -2173,6 +2173,8 @@ static int zebra_vxlan_handle_vni_transition(struct zebra_vrf *zvrf, vni_t vni, return 0; zevpn = zebra_evpn_add(vni); + if (!zevpn) + return -1; /* Find bridge interface for the VNI */ vlan_if = zvni_map_to_svi(vxl->access_vlan, @@ -5893,6 +5895,7 @@ void zebra_vxlan_close_tables(struct zebra_vrf *zvrf) return; hash_iterate(zvrf->evpn_table, zebra_evpn_vxlan_cleanup_all, zvrf); hash_free(zvrf->evpn_table); + zvrf->evpn_table = NULL; if (zvrf->vxlan_sg_table) { zebra_vxlan_cleanup_sg_table(zvrf); hash_free(zvrf->vxlan_sg_table);