summaryrefslogtreecommitdiffstats
path: root/src/vnet/dpo
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-04-18 12:56:45 -0700
committerNeale Ranns <nranns@cisco.com>2017-04-18 19:57:31 +0000
commit994dab40555427792aff0f75bd970dfaae8163ee (patch)
treebf5a5e6ac98aa11f73538e011f97586098192b2e /src/vnet/dpo
parente7b6734bc9a3530e215164e255141224a099661e (diff)
Memory leak in load-balance maps
Change-Id: Iec67ae1232e346d5e0000e0b4c997fdc31865bc6 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/dpo')
-rw-r--r--src/vnet/dpo/load_balance_map.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/vnet/dpo/load_balance_map.c b/src/vnet/dpo/load_balance_map.c
index 70ce1bf7c39..4e27e5db3d8 100644
--- a/src/vnet/dpo/load_balance_map.c
+++ b/src/vnet/dpo/load_balance_map.c
@@ -415,6 +415,14 @@ load_balance_map_init (load_balance_map_t *lbm,
return (lbm);
}
+static void
+load_balance_map_destroy (load_balance_map_t *lbm)
+{
+ vec_free(lbm->lbm_paths);
+ vec_free(lbm->lbm_buckets);
+ pool_put(load_balance_map_pool, lbm);
+}
+
index_t
load_balance_map_add_or_lock (u32 n_buckets,
u32 sum_of_weights,
@@ -434,6 +442,7 @@ load_balance_map_add_or_lock (u32 n_buckets,
else
{
lbm = load_balance_map_get(lbmi);
+ load_balance_map_destroy(tmp);
}
lbm->lbm_locks++;
@@ -468,9 +477,7 @@ load_balance_map_unlock (index_t lbmi)
if (0 == lbm->lbm_locks)
{
load_balance_map_db_remove(lbm);
- vec_free(lbm->lbm_paths);
- vec_free(lbm->lbm_buckets);
- pool_put(load_balance_map_pool, lbm);
+ load_balance_map_destroy(lbm);
}
}