isisd: Prevent usage after free

Store the vrf_id so that when we free the area we can
do further cleanup work.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2020-09-24 07:56:13 -04:00
parent 7895c3bc4f
commit f12296baac

View File

@ -80,14 +80,18 @@ int isis_instance_create(struct nb_cb_create_args *args)
int isis_instance_destroy(struct nb_cb_destroy_args *args)
{
struct isis_area *area;
vrf_id_t vrf_id;
if (args->event != NB_EV_APPLY)
return NB_OK;
area = nb_running_unset_entry(args->dnode);
vrf_id = area->isis->vrf_id;
isis_area_destroy(area);
/* remove ldp-sync config */
if (area->isis->vrf_id == VRF_DEFAULT)
if (vrf_id == VRF_DEFAULT)
isis_ldp_sync_gbl_exit(true);
return NB_OK;