From 6f2a58879d71fbb44630b3dc8cd1e0026fc6b72e Mon Sep 17 00:00:00 2001 From: InspurSDN Date: Tue, 2 Jul 2024 16:29:47 +0800 Subject: [PATCH] [FRR] Adding patch to fix isisd memory leak 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 --- .../patch/0030-isisd-Fix-memory-leak.patch | 25 +++++++++++++++++++ src/sonic-frr/patch/series | 1 + 2 files changed, 26 insertions(+) create mode 100644 src/sonic-frr/patch/0030-isisd-Fix-memory-leak.patch diff --git a/src/sonic-frr/patch/0030-isisd-Fix-memory-leak.patch b/src/sonic-frr/patch/0030-isisd-Fix-memory-leak.patch new file mode 100644 index 000000000000..f1ffade818de --- /dev/null +++ b/src/sonic-frr/patch/0030-isisd-Fix-memory-leak.patch @@ -0,0 +1,25 @@ +From 45f5ba53f94d97c4b1cf31fd0bca01167cd727cb Mon Sep 17 00:00:00 2001 +From: Tyler Li +Date: Tue, 9 Apr 2024 14:43:19 +0800 +Subject: [PATCH] isisd: Fix memory leak + +Signed-off-by: Tyler Li +--- + 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 + diff --git a/src/sonic-frr/patch/series b/src/sonic-frr/patch/series index 445bc9dd9653..6eb099128d60 100644 --- a/src/sonic-frr/patch/series +++ b/src/sonic-frr/patch/series @@ -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