On 04/19/2013 12:42 PM, Patrik Flykt wrote:
On Fri, 2013-04-19 at 10:09 +0200, Daniel Wagner wrote:
The 'policy->session != NULL' is basically testing if the refcount is
1
or 2. Okay, I agree that is rather stupid.

Just unref() as the last step, no data can be trusted after and unref.

What about

static void remove_policy(struct policy_data *policy)
{
        connman_session_set_default_config(policy->config);
        update_session(policy);

        g_hash_table_remove(file_hash, policy->filename);
        policy_unref(policy);
}

? If there is no session attached to the policy we will do some unnecessary operation in connman_session_set_default_config(). But it improves the readability of the code.

cheer,
daniel
_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to