summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2022-08-15 17:49:50 +0200
committerDonald Sharp <sharpd@nvidia.com>2022-08-15 21:45:05 +0200
commit43a8e0ac88482a61aa99134b744805bf3a6b8e4c (patch)
tree1db5583e607fc232ae07663a4bab45d81724a5fb /lib
parentpimd: vrf may be NULL from pim_cmd_lookup_vrf (diff)
downloadfrr-43a8e0ac88482a61aa99134b744805bf3a6b8e4c.tar.xz
frr-43a8e0ac88482a61aa99134b744805bf3a6b8e4c.zip
lib: Ensure ls_msg2edge does not use memory after freeing
ls_msg2edge calls ls_edge_del_all which will free the edge variable. Ensure that FRR properly returns NULL. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/link_state.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/link_state.c b/lib/link_state.c
index 0ef87b7a5..ab5a8515b 100644
--- a/lib/link_state.c
+++ b/lib/link_state.c
@@ -1791,9 +1791,10 @@ struct ls_edge *ls_msg2edge(struct ls_ted *ted, struct ls_message *msg,
case LS_MSG_EVENT_DELETE:
edge = ls_find_edge_by_source(ted, attr);
if (edge) {
- if (delete)
+ if (delete) {
ls_edge_del_all(ted, edge);
- else
+ edge = NULL;
+ } else
edge->status = DELETE;
}
break;