summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-10-31 10:33:30 +0100
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-11-05 14:42:17 +0200
commita475f99d89f5f9615c31400f4a7126be871c3152 (patch)
tree7d72e360d457e38f742fa6ed1fbee66496aa9258 /src
parent57fa40851534c3c9f2ca0267108a915cdc467c9e (diff)
downloadconnman-a475f99d89f5f9615c31400f4a7126be871c3152.tar.gz
connman-a475f99d89f5f9615c31400f4a7126be871c3152.tar.bz2
connman-a475f99d89f5f9615c31400f4a7126be871c3152.zip
session: Policy register should check callback existence
Let's ensure that the policy plugin has all necessary callbacks installed when connman_session_policy_register() is called. The rest of the code expects that the create() and destroy() callbacks exist whenever a plugin is used.
Diffstat (limited to 'src')
-rw-r--r--src/session.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/session.c b/src/session.c
index c981befa..2b06e3f3 100644
--- a/src/session.c
+++ b/src/session.c
@@ -314,6 +314,9 @@ int connman_session_policy_register(struct connman_session_policy *policy)
{
DBG("name %s", policy->name);
+ if (policy->create == NULL || policy->destroy == NULL)
+ return -EINVAL;
+
policy_list = g_slist_insert_sorted(policy_list, policy,
compare_priority);