From: Daniel Wagner <daniel.wag...@bmw-carit.de>

The update flag indicates if the policy is still valid after
the unref. That is when a session is using the policy and
the corresponding file is removed. Just update before unref policy.
---
 plugins/session_policy_local.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/plugins/session_policy_local.c b/plugins/session_policy_local.c
index 21b794d..33152ab 100644
--- a/plugins/session_policy_local.c
+++ b/plugins/session_policy_local.c
@@ -347,18 +347,12 @@ static void update_session(struct connman_session 
*session)
 
 static void remove_policy(struct policy_data *policy)
 {
-       connman_bool_t update = FALSE;
-
-       if (policy->session != NULL)
-               update = TRUE;
+       if (policy->session != NULL) {
+               connman_session_set_default_config(policy->config);
+               update_session(policy->session);
+       }
 
        policy_unref(policy);
-
-       if (update == FALSE)
-               return;
-
-       connman_session_set_default_config(policy->config);
-       update_session(policy->session);
 }
 
 static void notify_handler(struct inotify_event *event,
-- 
1.8.2.rc3.16.gce432ca

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to