From 208c53c90e06843b741839c65cb438764ecd5e4d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 8 Aug 2024 14:04:42 -0400 Subject: [PATCH] isisd, lib: Cleanup linked list associated with snmp Signed-off-by: Donald Sharp --- isisd/isis_snmp.c | 8 ++++++++ lib/agentx.c | 5 +++++ lib/smux.h | 1 + 3 files changed, 14 insertions(+) diff --git a/isisd/isis_snmp.c b/isisd/isis_snmp.c index f9e3780e29e3..83a06b69980b 100644 --- a/isisd/isis_snmp.c +++ b/isisd/isis_snmp.c @@ -2826,6 +2826,13 @@ static int isis_snmp_init(struct event_loop *tm) return 0; } +static int isis_snmp_terminate(void) +{ + smux_terminate(); + + return 0; +} + /* * ISIS notification functions: we have one function per notification */ @@ -3448,6 +3455,7 @@ static int isis_snmp_module_init(void) hook_register(isis_circuit_del_hook, isis_circuit_snmp_id_free); hook_register(frr_late_init, isis_snmp_init); + hook_register(frr_fini, isis_snmp_terminate); return 0; } diff --git a/lib/agentx.c b/lib/agentx.c index 19f2a6b7fce8..2e621d06a44d 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -377,4 +377,9 @@ void smux_events_update(void) agentx_events_update(); } +void smux_terminate(void) +{ + if (events) + list_delete(&events); +} #endif /* SNMP_AGENTX */ diff --git a/lib/smux.h b/lib/smux.h index 8ec847afd01f..0ed41410f57b 100644 --- a/lib/smux.h +++ b/lib/smux.h @@ -101,6 +101,7 @@ extern bool smux_enabled(void); extern void libagentx_init(void); extern void smux_init(struct event_loop *tm); +extern void smux_terminate(void); extern void smux_agentx_enable(void); extern void smux_register_mib(const char *, struct variable *, size_t, int, oid[], size_t);