diff options
| author | Russ White <russ@riw.us> | 2023-08-29 08:04:01 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-29 08:04:01 -0400 |
| commit | 72ff639da524914c057f8f3fbe050aa36cb10fa7 (patch) | |
| tree | d2ac42f2fdb77c436574620ef0f2cfbb8c524602 /lib/link_state.c | |
| parent | c4e030ac87687b15418df652f69e3959c58de0e2 (diff) | |
| parent | 400ec19919679513c30cd29f2cfc1e4ed942e604 (diff) | |
Merge pull request #14257 from Keelan10/lib-memleak
lib: Fix memory leaks in LS Update Functions
Diffstat (limited to 'lib/link_state.c')
| -rw-r--r-- | lib/link_state.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/link_state.c b/lib/link_state.c index 6537f881ce..105e3e28a9 100644 --- a/lib/link_state.c +++ b/lib/link_state.c @@ -523,7 +523,9 @@ struct ls_vertex *ls_vertex_update(struct ls_ted *ted, struct ls_node *node) if (!ls_node_same(old->node, node)) { ls_node_del(old->node); old->node = node; - } + } else + ls_node_del(node); + old->status = UPDATE; return old; } @@ -805,7 +807,9 @@ struct ls_edge *ls_edge_update(struct ls_ted *ted, if (!ls_attributes_same(old->attributes, attributes)) { ls_attributes_del(old->attributes); old->attributes = attributes; - } + } else + ls_attributes_del(attributes); + old->status = UPDATE; return old; } @@ -902,7 +906,9 @@ struct ls_subnet *ls_subnet_update(struct ls_ted *ted, struct ls_prefix *pref) if (!ls_prefix_same(old->ls_pref, pref)) { ls_prefix_del(old->ls_pref); old->ls_pref = pref; - } + } else + ls_prefix_del(pref); + old->status = UPDATE; return old; } |
