diff options
author | Keelan10 <keelan.cannoo@icloud.com> | 2023-04-03 09:41:04 +0200 |
---|---|---|
committer | Keelan10 <keelan.cannoo@icloud.com> | 2023-04-07 09:41:21 +0200 |
commit | c123d2dee012620b8f43711062a10c49b9247a9c (patch) | |
tree | b9e71ac58ed829a567b6237c0e6f35eb6c52b5aa /lib/link_state.c | |
parent | Merge pull request #13182 from taspelund/add_bgp_json_comments (diff) | |
download | frr-c123d2dee012620b8f43711062a10c49b9247a9c.tar.xz frr-c123d2dee012620b8f43711062a10c49b9247a9c.zip |
lib: Fix link state memory leak
Free link message data when a delete event is recorded.
Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
Diffstat (limited to 'lib/link_state.c')
-rw-r--r-- | lib/link_state.c | 14 |
1 files changed, 14 insertions, 0 deletions
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); } |