From: Daniel Wagner <daniel.wag...@bmw-carit.de> We want to use this code snippet for the error case in __connman_session_create() too. --- src/session.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/session.c b/src/session.c index f5d3a6d..314a51d 100644 --- a/src/session.c +++ b/src/session.c @@ -844,6 +844,19 @@ static gint sort_services(gconstpointer a, gconstpointer b, gpointer user_data) session); } +static void free_session(struct connman_session *session) +{ + destroy_policy_config(session); + connman_session_free_bearers(session->info->config.allowed_bearers); + g_free(session->owner); + g_free(session->session_path); + g_free(session->notify_path); + g_free(session->info); + g_free(session->info_last); + + g_free(session); +} + static void cleanup_session(gpointer user_data) { struct connman_session *session = user_data; @@ -859,15 +872,7 @@ static void cleanup_session(gpointer user_data) __connman_service_disconnect(info->entry->service); } - destroy_policy_config(session); - connman_session_free_bearers(session->info->config.allowed_bearers); - g_free(session->owner); - g_free(session->session_path); - g_free(session->notify_path); - g_free(session->info); - g_free(session->info_last); - - g_free(session); + free_session(session); } static enum connman_session_state service_to_session_state(enum connman_service_state state) -- 1.7.12.1.382.gb0576a6 _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman