Fix profile cleanup race condition
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 30 Aug 2009 06:26:15 +0000 (23:26 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 30 Aug 2009 06:26:15 +0000 (23:26 -0700)
src/profile.c

index 0b2a411..71a3067 100644 (file)
@@ -706,15 +706,13 @@ void __connman_profile_cleanup(void)
 {
        DBG("");
 
-       if (profiles != NULL) {
-               g_hash_table_destroy(profiles);
-               profiles = NULL;
-       }
-
-       connman_storage_unregister(&profile_storage);
-
        if (connection == NULL)
                return;
 
+       g_hash_table_destroy(profiles);
+       profiles = NULL;
+
+       connman_storage_unregister(&profile_storage);
+
        dbus_connection_unref(connection);
 }