diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-10-31 10:33:28 +0100 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-11-05 14:40:26 +0200 |
commit | 66fe286e81325fc6a30f6cd4982574b93e7f2a4c (patch) | |
tree | 0c3ae0555f52c1c845953c2bda8e461ff47dc3dc /src/session.c | |
parent | 728983ff6cd60fb9a827d76dbbc77f65c66783b3 (diff) | |
download | connman-66fe286e81325fc6a30f6cd4982574b93e7f2a4c.tar.gz connman-66fe286e81325fc6a30f6cd4982574b93e7f2a4c.tar.bz2 connman-66fe286e81325fc6a30f6cd4982574b93e7f2a4c.zip |
session: Factor out memory release part of cleanup_session
We want to reuse this code snippet for the error case in
__connman_session_create() too.
Diffstat (limited to 'src/session.c')
-rw-r--r-- | src/session.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/session.c b/src/session.c index 3d497b86..e4897424 100644 --- a/src/session.c +++ b/src/session.c @@ -878,6 +878,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; @@ -893,15 +906,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) |