From: Daniel Wagner <[email protected]>

Introduce the second hash table which tracks the config object lifetime
based on the file existens. The parsing of the file and creation of the
config object is part of the next patch.
---
 plugins/session_policy_ivi.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/plugins/session_policy_ivi.c b/plugins/session_policy_ivi.c
index df341a3..9401754 100644
--- a/plugins/session_policy_ivi.c
+++ b/plugins/session_policy_ivi.c
@@ -39,6 +39,7 @@
 static DBusConnection *connection;
 
 static GHashTable *session_hash;
+static GHashTable *ident_hash;
 
 struct create_data {
        struct connman_session *session;
@@ -216,9 +217,23 @@ static int session_policy_ivi_init(void)
                goto err;
        }
 
+       ident_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
+                                               g_free, NULL);
+       if (ident_hash == NULL) {
+               err = -ENOMEM;
+               connman_session_policy_unregister(&session_policy_ivi);
+               goto err;
+       }
+
        return 0;
 
 err:
+       if (session_hash != NULL)
+               g_hash_table_destroy(session_hash);
+
+       if (ident_hash != NULL)
+               g_hash_table_destroy(ident_hash);
+
        dbus_connection_unref(connection);
 
        return err;
@@ -238,6 +253,7 @@ static void session_policy_ivi_exit(void)
        }
 
        g_hash_table_destroy(session_hash);
+       g_hash_table_destroy(ident_hash);
 
        connman_session_policy_unregister(&session_policy_ivi);
 
-- 
1.8.0.rc0

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to