I think i've found out a bug in connectivity-networkmanager.c code, which causes a crash when the nm module does not return any available device. I guess that should not happen under regular conditions, with the NetworkManager being well configured, which i think thats not the case of my testing environment (i am using gentoo), but anyway, i think the code is buggy because it should check if the "device" variable is NULL before using it.
I've attached a preliminary patch to show the problem. If we all agree its actually a bug, i could open it in the bugzilla and work on a more serious patch proposal. -- Javier Fernández García-Boente http://blogs.igalia.com/jfernandez/ www.igalia.com
commit 30c75fdf506b22f03303153555603a8e9dd399eb Author: Javier Fernandez <[email protected]> Date: Sun Apr 18 14:47:06 2010 +0000 Avoid a crash caused by a NULL pointer access when no devices found by the NetworkManager. diff --git a/src/connectivity-networkmanager.c b/src/connectivity-networkmanager.c index 95f1c37..4cab61a 100644 --- a/src/connectivity-networkmanager.c +++ b/src/connectivity-networkmanager.c @@ -88,16 +88,16 @@ cache_ap_mac (GeoclueNetworkManager *self) const GPtrArray *devices; guint i; - devices = nm_client_get_devices (self->client); - if (devices == NULL) { - g_free (self->cache_ap_mac); - self->cache_ap_mac = NULL; - } - g_free (self->cache_ap_mac); self->cache_ap_mac = NULL; self->ap_strength = 0; + devices = nm_client_get_devices (self->client); + if (devices == NULL) { + g_warning ("NetworkManager found no devices."); + return; + } + for (i = 0; i < devices->len; i++) { NMDevice *device = g_ptr_array_index (devices, i); if (NM_IS_DEVICE_WIFI (device)) {
signature.asc
Description: This is a digitally signed message part
_______________________________________________ GeoClue mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/geoclue
