From c123d2dee012620b8f43711062a10c49b9247a9c Mon Sep 17 00:00:00 2001 From: Keelan10 Date: Mon, 3 Apr 2023 11:41:04 +0400 Subject: lib: Fix link state memory leak Free link message data when a delete event is recorded. Signed-off-by: Keelan Cannoo --- lib/link_state.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/link_state.c') diff --git a/lib/link_state.c b/lib/link_state.c index 589c0ae70..b501018be 100644 --- a/lib/link_state.c +++ b/lib/link_state.c @@ -1905,6 +1905,20 @@ void ls_delete_msg(struct ls_message *msg) if (msg == NULL) return; + if (msg->event == LS_MSG_EVENT_DELETE) { + switch (msg->type) { + case LS_MSG_TYPE_NODE: + ls_node_del(msg->data.node); + break; + case LS_MSG_TYPE_ATTRIBUTES: + ls_attributes_del(msg->data.attr); + break; + case LS_MSG_TYPE_PREFIX: + ls_prefix_del(msg->data.prefix); + break; + } + } + XFREE(MTYPE_LS_DB, msg); } -- cgit v1.2.3