summaryrefslogtreecommitdiff
path: root/zebra/zebra_mpls.c
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2022-07-18 14:26:29 +0300
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2022-07-18 17:43:36 +0000
commit06344732900e91a4ae4001c3f28cba9c3acd348c (patch)
treeecef8417fd70939e1b0c18ca2844041135c95e29 /zebra/zebra_mpls.c
parent57745ad4c86d0dc7537740ab1a94b01d6525b565 (diff)
zebra: Cleanup the memory from the hash for MPLS stuff
==1595641== 280 (80 direct, 200 indirect) bytes in 1 blocks are definitely lost in loss record 30 of 38 ==1595641== at 0x483AB65: calloc (vg_replace_malloc.c:760) ==1595641== by 0x493C89C: qcalloc (memory.c:116) ==1595641== by 0x1E8426: lsp_alloc (zebra_mpls.c:1116) ==1595641== by 0x49147F1: hash_get (hash.c:162) ==1595641== by 0x1EC880: mpls_lsp_install (zebra_mpls.c:3192) ==1595641== by 0x1C51BB: zread_vrf_label (zapi_msg.c:3197) ==1595641== by 0x1C6F11: zserv_handle_commands (zapi_msg.c:3863) ==1595641== by 0x24D0F4: zserv_process_messages (zserv.c:523) ==1595641== by 0x498F4CC: thread_call (thread.c:2002) ==1595641== by 0x49253A2: frr_run (libfrr.c:1198) ==1595641== by 0x1A28BA: main (main.c:475) ==1595641== ==1595641== 1,400 (400 direct, 1,000 indirect) bytes in 5 blocks are definitely lost in loss record 35 of 38 ==1595641== at 0x483AB65: calloc (vg_replace_malloc.c:760) ==1595641== by 0x493C89C: qcalloc (memory.c:116) ==1595641== by 0x1E8426: lsp_alloc (zebra_mpls.c:1116) ==1595641== by 0x49147F1: hash_get (hash.c:162) ==1595641== by 0x1EBD7C: mpls_zapi_labels_process (zebra_mpls.c:2915) ==1595641== by 0x1C35D9: zread_mpls_labels_add (zapi_msg.c:2513) ==1595641== by 0x1C6F11: zserv_handle_commands (zapi_msg.c:3863) ==1595641== by 0x24D0F4: zserv_process_messages (zserv.c:523) ==1595641== by 0x498F4CC: thread_call (thread.c:2002) ==1595641== by 0x49253A2: frr_run (libfrr.c:1198) ==1595641== by 0x1A28BA: main (main.c:475) Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org> (cherry picked from commit 912b6a5b5c4351b5386dc267db46797f3ffc33d4)
Diffstat (limited to 'zebra/zebra_mpls.c')
-rw-r--r--zebra/zebra_mpls.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index 8237bebf3b..cca17f1a31 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -4010,6 +4010,13 @@ void zebra_mpls_client_cleanup_vrf_label(uint8_t proto)
}
}
+static void lsp_table_free(void *p)
+{
+ struct zebra_lsp *lsp = p;
+
+ XFREE(MTYPE_LSP, lsp);
+}
+
/*
* Called upon process exiting, need to delete LSP forwarding
* entries from the kernel.
@@ -4018,9 +4025,9 @@ void zebra_mpls_client_cleanup_vrf_label(uint8_t proto)
void zebra_mpls_close_tables(struct zebra_vrf *zvrf)
{
hash_iterate(zvrf->lsp_table, lsp_uninstall_from_kernel, NULL);
- hash_clean(zvrf->lsp_table, NULL);
+ hash_clean(zvrf->lsp_table, lsp_table_free);
hash_free(zvrf->lsp_table);
- hash_clean(zvrf->slsp_table, NULL);
+ hash_clean(zvrf->slsp_table, lsp_table_free);
hash_free(zvrf->slsp_table);
route_table_finish(zvrf->fec_table[AFI_IP]);
route_table_finish(zvrf->fec_table[AFI_IP6]);