diff options
author | Donald Sharp <donaldsharp72@gmail.com> | 2022-04-06 00:27:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-06 00:27:52 +0200 |
commit | c416dd8298e2b19ca3561f997cf40d9d0bd00166 (patch) | |
tree | 1ddf5892bda1a15aa9df6599a00071e71808994e | |
parent | Merge pull request #10365 from SaiGomathiN/ipv6-config-cmd (diff) | |
parent | bgpd: No need to check for NULL before calling XFREE() in RPKI code (diff) | |
download | frr-c416dd8298e2b19ca3561f997cf40d9d0bd00166.tar.xz frr-c416dd8298e2b19ca3561f997cf40d9d0bd00166.zip |
Merge pull request #10966 from opensourcerouting/fix/memory_leak_rpki
bgpd: RPKI changes
-rw-r--r-- | bgpd/bgp_rpki.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index c724b938d..a7bc89e64 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -67,6 +67,7 @@ static struct thread *t_rpki; DEFINE_MTYPE_STATIC(BGPD, BGP_RPKI_CACHE, "BGP RPKI Cache server"); DEFINE_MTYPE_STATIC(BGPD, BGP_RPKI_CACHE_GROUP, "BGP RPKI Cache server group"); +DEFINE_MTYPE_STATIC(BGPD, BGP_RPKI_RTRLIB, "BGP RPKI RTRLib"); #define POLLING_PERIOD_DEFAULT 3600 #define EXPIRE_INTERVAL_DEFAULT 7200 @@ -156,17 +157,17 @@ static const struct route_map_rule_cmd route_match_rpki_cmd = { static void *malloc_wrapper(size_t size) { - return XMALLOC(MTYPE_BGP_RPKI_CACHE, size); + return XMALLOC(MTYPE_BGP_RPKI_RTRLIB, size); } static void *realloc_wrapper(void *ptr, size_t size) { - return XREALLOC(MTYPE_BGP_RPKI_CACHE, ptr, size); + return XREALLOC(MTYPE_BGP_RPKI_RTRLIB, ptr, size); } static void free_wrapper(void *ptr) { - XFREE(MTYPE_BGP_RPKI_CACHE, ptr); + XFREE(MTYPE_BGP_RPKI_RTRLIB, ptr); } static void init_tr_socket(struct cache *cache) @@ -902,9 +903,8 @@ static void free_cache(struct cache *cache) if (cache->type == TCP) { XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.tcp_config->host); XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.tcp_config->port); - if (cache->tr_config.tcp_config->bindaddr) - XFREE(MTYPE_BGP_RPKI_CACHE, - cache->tr_config.tcp_config->bindaddr); + XFREE(MTYPE_BGP_RPKI_CACHE, + cache->tr_config.tcp_config->bindaddr); XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.tcp_config); } #if defined(FOUND_SSH) @@ -916,9 +916,8 @@ static void free_cache(struct cache *cache) cache->tr_config.ssh_config->client_privkey_path); XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.ssh_config->server_hostkey_path); - if (cache->tr_config.ssh_config->bindaddr) - XFREE(MTYPE_BGP_RPKI_CACHE, - cache->tr_config.ssh_config->bindaddr); + XFREE(MTYPE_BGP_RPKI_CACHE, + cache->tr_config.ssh_config->bindaddr); XFREE(MTYPE_BGP_RPKI_CACHE, cache->tr_config.ssh_config); } #endif |