From 28089e2b59dbe5c136297a86b5c8fc40bc4e1ca7 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 9 Jun 2022 17:06:13 +0200 Subject: [PATCH] [SMF] Fix smf_gtp_node objects not freed during shutdown (#1593) --- src/smf/context.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/smf/context.c b/src/smf/context.c index 6a7372e90..40734eab4 100644 --- a/src/smf/context.c +++ b/src/smf/context.c @@ -18,6 +18,7 @@ */ #include "context.h" +#include "gtp-path.h" #include "pfcp-path.h" static smf_context_t self; @@ -102,6 +103,7 @@ void smf_context_init(void) void smf_context_final(void) { + ogs_gtp_node_t *gnode = NULL, *next_gnode = NULL; ogs_assert(context_initialized == 1); smf_ue_remove_all(); @@ -123,7 +125,12 @@ void smf_context_final(void) ogs_pool_final(&smf_pf_pool); - ogs_gtp_node_remove_all(&self.sgw_s5c_list); + ogs_list_for_each_entry_safe(&self.sgw_s5c_list, next_gnode, gnode, node) { + smf_gtp_node_t *smf_gnode = gnode->data_ptr; + ogs_assert(smf_gnode); + smf_gtp_node_free(smf_gnode); + ogs_gtp_node_remove(&self.sgw_s5c_list, gnode); + } context_initialized = 0; }