summaryrefslogtreecommitdiff
path: root/src/session.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-10-02 16:11:53 +0200
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-10-02 16:22:31 +0200
commitc4b5683576c11b2ae8e54da0e1bc03b6c1c67998 (patch)
treeb8a4839a92b047d846b16a14714f910500b4cdbf /src/session.c
parentbb9098e011846fd1985a2b6eda185d8ebf6abb6e (diff)
downloadconnman-c4b5683576c11b2ae8e54da0e1bc03b6c1c67998.tar.gz
connman-c4b5683576c11b2ae8e54da0e1bc03b6c1c67998.tar.bz2
connman-c4b5683576c11b2ae8e54da0e1bc03b6c1c67998.zip
session: If no policy plugin is selected use default config
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/session.c b/src/session.c
index de25f789..3d497b86 100644
--- a/src/session.c
+++ b/src/session.c
@@ -240,7 +240,11 @@ static int create_policy_config(struct connman_session *session)
{
struct connman_session_config *config;
- config = (*session->policy->create)(session);
+ if (session->policy == NULL)
+ config = connman_session_create_default_config();
+ else
+ config = (*session->policy->create)(session);
+
if (config == NULL)
return -ENOMEM;
@@ -251,7 +255,13 @@ static int create_policy_config(struct connman_session *session)
static void destroy_policy_config(struct connman_session *session)
{
- (*session->policy->destroy)(session);
+ if (session->policy == NULL) {
+ connman_session_free_bearers(
+ session->policy_config->allowed_bearers);
+ g_free(session->policy_config);
+ } else {
+ (*session->policy->destroy)(session);
+ }
}
static void probe_policy(struct connman_session_policy *policy)