From: Daniel Wagner Date: Wed, 31 Oct 2012 09:33:30 +0000 (+0100) Subject: session: Policy register should check callback existence X-Git-Tag: 1.10~217 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a475f99d89f5f9615c31400f4a7126be871c3152;p=platform%2Fupstream%2Fconnman.git 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. --- diff --git a/src/session.c b/src/session.c index c981bef..2b06e3f 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);