connection: Check gateway_hash value before call update_order()
authorMartin Xu <martin.xu@intel.com>
Tue, 22 Feb 2011 06:23:26 +0000 (14:23 +0800)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 22 Feb 2011 08:19:33 +0000 (00:19 -0800)
When exit from ConnMan, __connman_connection_cleanup() is called
before __connman_service_cleanup() which then calls update_order().
__connman_connection_cleanup() sets gateway_hash as NULL, so update_order()
will access NULL hash and causes GLib-CRITICAL abort

src/connection.c

index 6b2dd2b..793bc8f 100644 (file)
@@ -385,6 +385,9 @@ gboolean __connman_connection_update_gateway(void)
        struct gateway_data *active_gateway, *default_gateway;
        gboolean updated = FALSE;
 
+       if (gateway_hash == NULL)
+               return updated;
+
        update_order();
 
        active_gateway = find_active_gateway();