summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/astobj2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index 007f12545..0bba65f17 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -808,9 +808,18 @@ static int cd_cb_debug(void *obj, void *arg, int flag)
static void container_destruct(void *_c)
{
struct ao2_container *c = _c;
+ int i;
_ao2_callback(c, OBJ_UNLINK, cd_cb, NULL);
+ for (i = 0; i < c->n_buckets; i++) {
+ struct bucket_list *cur;
+
+ while ((cur = AST_LIST_REMOVE_HEAD(&c->buckets[i], entry))) {
+ ast_free(cur);
+ }
+ }
+
#ifdef AO2_DEBUG
ast_atomic_fetchadd_int(&ao2.total_containers, -1);
#endif