From 4fff31a427311a7bdec99d865c2d353f6e8ce879 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Mon, 27 Feb 2023 16:26:32 +0200 Subject: [PATCH] bgpd: Free temporary memory after using argv_concat() Signed-off-by: Donatas Abraitis --- bgpd/bgp_vty.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index b960cd3499..826ca9dd3e 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -8795,7 +8795,7 @@ DEFPY(neighbor_path_attribute_discard, { struct peer *peer; int idx = 0; - const char *discard_attrs = NULL; + char *discard_attrs = NULL; peer = peer_and_group_lookup_vty(vty, neighbor); if (!peer) @@ -8807,6 +8807,8 @@ DEFPY(neighbor_path_attribute_discard, bgp_path_attribute_discard_vty(vty, peer, discard_attrs, true); + XFREE(MTYPE_TMP, discard_attrs); + return CMD_SUCCESS; } @@ -8822,7 +8824,7 @@ DEFPY(no_neighbor_path_attribute_discard, { struct peer *peer; int idx = 0; - const char *discard_attrs = NULL; + char *discard_attrs = NULL; peer = peer_and_group_lookup_vty(vty, neighbor); if (!peer) @@ -8834,6 +8836,8 @@ DEFPY(no_neighbor_path_attribute_discard, bgp_path_attribute_discard_vty(vty, peer, discard_attrs, false); + XFREE(MTYPE_TMP, discard_attrs); + return CMD_SUCCESS; }