diff --git a/sharpd/sharp_main.c b/sharpd/sharp_main.c index 0cbed5579dba..1eba9037ae93 100644 --- a/sharpd/sharp_main.c +++ b/sharpd/sharp_main.c @@ -60,6 +60,7 @@ static void sharp_global_init(void) { memset(&sg, 0, sizeof(sg)); sg.nhs = list_new(); + sg.nhs->del = (void (*)(void *))sharp_nh_tracker_free; sg.ted = NULL; sg.srv6_locators = list_new(); } diff --git a/sharpd/sharp_nht.c b/sharpd/sharp_nht.c index fa7880572d9d..8c02f1f213e3 100644 --- a/sharpd/sharp_nht.c +++ b/sharpd/sharp_nht.c @@ -40,6 +40,11 @@ struct sharp_nh_tracker *sharp_nh_tracker_get(struct prefix *p) return nht; } +void sharp_nh_tracker_free(struct sharp_nh_tracker *nht) +{ + XFREE(MTYPE_NH_TRACKER, nht); +} + void sharp_nh_tracker_dump(struct vty *vty) { struct listnode *node; diff --git a/sharpd/sharp_nht.h b/sharpd/sharp_nht.h index 5523f2807975..b27952ac511c 100644 --- a/sharpd/sharp_nht.h +++ b/sharpd/sharp_nht.h @@ -18,6 +18,7 @@ struct sharp_nh_tracker { }; extern struct sharp_nh_tracker *sharp_nh_tracker_get(struct prefix *p); +extern void sharp_nh_tracker_free(struct sharp_nh_tracker *nht); extern void sharp_nh_tracker_dump(struct vty *vty);