Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sharpd: Set Callback Function for Memory Cleanup #14802

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sharpd/sharp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
5 changes: 5 additions & 0 deletions sharpd/sharp_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions sharpd/sharp_nht.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading