Skip to content

Commit

Permalink
[FRR] Adding patch to fix isisd memory leak
Browse files Browse the repository at this point in the history
Fixing issue
Repeat command "ip router isis 5" and "no ip router isis 5", there is memory leak in isisd

- How I did it
Root cause of the problem:

The isis_lfa_excluded_ifaces_clear function in isis_lfa.c only clears the elements when clearing the hash table, but does not release the table itself.

Release memory in hash_free:

MTYPE_HASH*2
MTYPE_HASH_INDEX * 1
MTYPE_LINK_NODE * 1

Modification method:

Add hash_free after hash_clean, and there is no need to empty it after release.

- How to verify it
Repeat command "ip router isis 5" and "no ip router isis 5", no memory leak in isisd
  • Loading branch information
inspurSDN committed Jul 2, 2024
1 parent 0114373 commit 6f2a588
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/sonic-frr/patch/0030-isisd-Fix-memory-leak.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 45f5ba53f94d97c4b1cf31fd0bca01167cd727cb Mon Sep 17 00:00:00 2001
From: Tyler Li <litiezheng@ieisystem.com>
Date: Tue, 9 Apr 2024 14:43:19 +0800
Subject: [PATCH] isisd: Fix memory leak

Signed-off-by: Tyler Li <litiezheng@ieisystem.com>
---
isisd/isis_lfa.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c
index 84aac24d5..e99c4b805 100644
--- a/isisd/isis_lfa.c
+++ b/isisd/isis_lfa.c
@@ -255,6 +255,7 @@ void isis_lfa_excluded_ifaces_clear(struct isis_circuit *circuit, int level)
{
hash_clean(circuit->lfa_excluded_ifaces[level - 1],
lfa_excl_interface_hash_free);
+ hash_free(circuit->lfa_excluded_ifaces[level - 1]);
}

/**
--
2.37.1

1 change: 1 addition & 0 deletions src/sonic-frr/patch/series
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@
0027-lib-Do-not-convert-EVPN-prefixes-into-IPv4-IPv6-if-n.patch
0028-zebra-fix-parse-attr-problems-for-encap.patch
0029-zebra-nhg-fix-on-intf-up.patch
0030-isisd-Fix-memory-leak.patch

0 comments on commit 6f2a588

Please sign in to comment.