From 7bae2fb913ed56e3e559c8fbec2be7f0f85c60c2 Mon Sep 17 00:00:00 2001 From: Lou Berger Date: Fri, 30 Dec 2016 16:48:29 -0500 Subject: [PATCH] bgpd: fix ecommunity hash related leak Signed-off-by: Lou Berger --- bgpd/bgp_ecommunity.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index 6c72aa36d9..65415dcee2 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -54,6 +54,13 @@ ecommunity_free (struct ecommunity **ecom) ecom = NULL; } +static void +ecommunity_hash_free (struct ecommunity *ecom) +{ + ecommunity_free(&ecom); +} + + /* Add a new Extended Communities value to Extended Communities Attribute structure. When the value is already exists in the structure, we don't add the value. Newly added value is sorted by @@ -282,6 +289,7 @@ ecommunity_init (void) void ecommunity_finish (void) { + hash_clean (ecomhash, (void (*)(void *))ecommunity_hash_free); hash_free (ecomhash); ecomhash = NULL; }