bgpd: fix ecommunity hash related leak

Signed-off-by: Lou Berger <lberger@labn.net>
This commit is contained in:
Lou Berger 2016-12-30 16:48:29 -05:00
parent bede774450
commit 7bae2fb913

View File

@ -54,6 +54,13 @@ ecommunity_free (struct ecommunity **ecom)
ecom = NULL; ecom = NULL;
} }
static void
ecommunity_hash_free (struct ecommunity *ecom)
{
ecommunity_free(&ecom);
}
/* Add a new Extended Communities value to Extended Communities /* Add a new Extended Communities value to Extended Communities
Attribute structure. When the value is already exists in the Attribute structure. When the value is already exists in the
structure, we don't add the value. Newly added value is sorted by structure, we don't add the value. Newly added value is sorted by
@ -282,6 +289,7 @@ ecommunity_init (void)
void void
ecommunity_finish (void) ecommunity_finish (void)
{ {
hash_clean (ecomhash, (void (*)(void *))ecommunity_hash_free);
hash_free (ecomhash); hash_free (ecomhash);
ecomhash = NULL; ecomhash = NULL;
} }