Skip to content

Commit

Permalink
Merge pull request FRRouting#16327 from FRRouting/mergify/bp/stable/1…
Browse files Browse the repository at this point in the history
…0.0/pr-15716

isisd: Fix memory leaks when the transition of neighbor state from non-UP to DOWN (backport FRRouting#15716)
  • Loading branch information
Jafaral authored Jul 2, 2024
2 parents f5a29e0 + 4ef87b1 commit edc1208
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions isisd/isis_adjacency.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,15 @@ void isis_adj_state_change(struct isis_adjacency **padj,
* purposes */
adj->last_flap = time(NULL);
adj->flaps++;
} else if (old_state == ISIS_ADJ_UP) {
circuit->adj_state_changes++;
} else {
if (old_state == ISIS_ADJ_UP) {
circuit->adj_state_changes++;

circuit->upadjcount[level - 1]--;
if (circuit->upadjcount[level - 1] == 0)
isis_tx_queue_clean(circuit->tx_queue);
circuit->upadjcount[level - 1]--;
if (circuit->upadjcount[level - 1] == 0)
isis_tx_queue_clean(
circuit->tx_queue);
}

if (new_state == ISIS_ADJ_DOWN) {
listnode_delete(
Expand Down Expand Up @@ -409,10 +412,13 @@ void isis_adj_state_change(struct isis_adjacency **padj,
master, send_l2_csnp, circuit,
0, &circuit->t_send_csnp[1]);
}
} else if (old_state == ISIS_ADJ_UP) {
circuit->upadjcount[level - 1]--;
if (circuit->upadjcount[level - 1] == 0)
isis_tx_queue_clean(circuit->tx_queue);
} else {
if (old_state == ISIS_ADJ_UP) {
circuit->upadjcount[level - 1]--;
if (circuit->upadjcount[level - 1] == 0)
isis_tx_queue_clean(
circuit->tx_queue);
}

if (new_state == ISIS_ADJ_DOWN) {
if (adj->circuit->u.p2p.neighbor == adj)
Expand Down

0 comments on commit edc1208

Please sign in to comment.