Hi Patrik, I have a few comments on this one:
On Tue, Sep 06, 2011 at 10:13:18AM +0300, [email protected] wrote: > diff --git a/plugins/wifi.c b/plugins/wifi.c > index e462639..92fcd37 100644 > --- a/plugins/wifi.c > +++ b/plugins/wifi.c > @@ -254,8 +254,10 @@ static int wifi_disable(struct connman_device *device) > wifi->connected = FALSE; > wifi->disconnecting = FALSE; > > - if (wifi->pending_network != NULL) > + if (wifi->pending_network != NULL) { > + connman_network_unref(wifi->pending_network); This could be a refcount leak as you could disable wifi before having bumped the pending_network refcount through network_connect(). > @@ -473,13 +477,16 @@ static int network_connect(struct connman_network > *network) > > ssid_init(ssid, network); > > + connman_network_ref(network); > if (wifi->disconnecting == TRUE) > wifi->pending_network = network; > else { > wifi->network = network; > > - return g_supplicant_interface_connect(interface, ssid, > + err = g_supplicant_interface_connect(interface, ssid, > connect_callback, network); > + if (err != -EINPROGRESS) > + connman_network_unref(network); > } > > return -EINPROGRESS; You need to return err here (and set it to -EINPROGRESS when disconnecting is true. > @@ -508,6 +515,7 @@ static void disconnect_callback(int result, > GSupplicantInterface *interface, > > if (wifi->pending_network != NULL) { > network_connect(wifi->pending_network); pending_network->refcount is set to 2 here. > + connman_network_unref(wifi->pending_network); And now back to 1, while the connection is going on. Isn't that what you're trying to avoid ? Cheers, Samuel. -- Intel Open Source Technology Centre http://oss.intel.com/ _______________________________________________ connman mailing list [email protected] http://lists.connman.net/listinfo/connman
