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 0b2a4119ed44088a148b0d7933f75bd144013015..71a3067d1aa77ffb4afa537d9711e4f2d2ed5923 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);
 }