From 0783b36d0eb68ec7dbe74f7498721ec1588eb396 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 12 Dec 2019 18:48:04 -0500 Subject: [PATCH 1/2] ripd, ripngd: Free up list after call into nb_cli_rpc We have a clear memory leak after running `clear ip rip` Fix this. Signed-off-by: Donald Sharp --- ripd/rip_cli.c | 7 ++++++- ripngd/ripng_cli.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c index 5c26c0cef7..7e2394f473 100644 --- a/ripd/rip_cli.c +++ b/ripd/rip_cli.c @@ -1001,6 +1001,7 @@ DEFPY (clear_ip_rip, VRF_CMD_HELP_STR) { struct list *input; + int ret; input = list_new(); if (vrf) { @@ -1011,7 +1012,11 @@ DEFPY (clear_ip_rip, listnode_add(input, yang_vrf); } - return nb_cli_rpc("/frr-ripd:clear-rip-route", input, NULL); + ret = nb_cli_rpc("/frr-ripd:clear-rip-route", input, NULL); + + list_delete(&input); + + return ret; } void rip_cli_init(void) diff --git a/ripngd/ripng_cli.c b/ripngd/ripng_cli.c index 2d9930e357..b3d92fb0d9 100644 --- a/ripngd/ripng_cli.c +++ b/ripngd/ripng_cli.c @@ -485,6 +485,7 @@ DEFPY (clear_ipv6_rip, VRF_CMD_HELP_STR) { struct list *input; + int ret; input = list_new(); if (vrf) { @@ -495,7 +496,11 @@ DEFPY (clear_ipv6_rip, listnode_add(input, yang_vrf); } - return nb_cli_rpc("/frr-ripngd:clear-ripng-route", input, NULL); + ret = nb_cli_rpc("/frr-ripngd:clear-ripng-route", input, NULL); + + list_delete(&input); + + return ret; } void ripng_cli_init(void) From ebeae7d58dd686bdfc4ecd65a56e187c7acbbb86 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 12 Dec 2019 19:30:21 -0500 Subject: [PATCH 2/2] isisd: Free memory when confused When you call into lsp_update with confusion, the lsp is purged and we do not do anything with the created tlv's from parsing the incoming data. To prevent the tlv's from being leaked note confusion and delete the unneeded data. Fixes: #5496 Signed-off-by: Donald Sharp --- isisd/isis_pdu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 71249cf658..cc22aa5ffd 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1054,6 +1054,8 @@ dontcheckadj: circuit->rcv_stream, circuit->area, level, lsp_confusion); + if (lsp_confusion) + isis_free_tlvs(tlvs); tlvs = NULL; /* ii */ lsp_flood_or_update(lsp, NULL,