aboutsummaryrefslogtreecommitdiffstats
path: root/extras/strongswan/vpp_sswan/kernel_vpp_net.c
diff options
context:
space:
mode:
authorGabriel Oginski <gabrielx.oginski@intel.com>2023-02-14 08:46:36 +0000
committerFan Zhang <fanzhang.oss@gmail.com>2023-03-02 13:23:24 +0000
commit2da99e50722f258618fa5fe53f93e603c97d4fe3 (patch)
tree6d9651d9d214ab321a897aec53158842be8c0a6c /extras/strongswan/vpp_sswan/kernel_vpp_net.c
parent9ad423fceb8d9877b337ada5fc1e053de21323b2 (diff)
vpp-swan: fix memory leaks
This patch fix the memory leaks discovered in the current implementation, inlcuding expired data, spd dump, and host names. Type: fix Signed-off-by: Gabriel Oginski <gabrielx.oginski@intel.com> Change-Id: I3794f5db3c58d1e78df25f242c91e7a67363de53
Diffstat (limited to 'extras/strongswan/vpp_sswan/kernel_vpp_net.c')
-rw-r--r--extras/strongswan/vpp_sswan/kernel_vpp_net.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/extras/strongswan/vpp_sswan/kernel_vpp_net.c b/extras/strongswan/vpp_sswan/kernel_vpp_net.c
index a29a7c6a4da..1ed58436286 100644
--- a/extras/strongswan/vpp_sswan/kernel_vpp_net.c
+++ b/extras/strongswan/vpp_sswan/kernel_vpp_net.c
@@ -545,6 +545,7 @@ update_addrs (private_kernel_vpp_net_t *this, iface_t *entry)
vl_api_ip_address_details_t *rmp, *tmp;
linked_list_t *addrs;
host_t *host;
+ enumerator_t *enumerator;
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
@@ -591,6 +592,13 @@ update_addrs (private_kernel_vpp_net_t *this, iface_t *entry)
vl_msg_api_free (mp);
free (out);
+ /* clean-up */
+ enumerator = entry->addrs->create_enumerator (entry->addrs);
+ while (enumerator->enumerate (enumerator, &host))
+ {
+ host->destroy (host);
+ }
+ enumerator->destroy (enumerator);
entry->addrs->destroy (entry->addrs);
entry->addrs =
linked_list_create_from_enumerator (addrs->create_enumerator (addrs));