if (result != 0) {
DBG("Failed to get maxspeed from signalpoll !");
+ connman_network_unref(network);
return;
}
strength = 100;
DBG("maxspeed = %d, strength = %d", maxspeed, strength);
- if (network) {
- connman_network_set_strength(network, (uint8_t)strength);
- connman_network_set_maxspeed(network, maxspeed);
- set_connection_mode(network, maxspeed);
- }
+
+ connman_network_set_strength(network, (uint8_t)strength);
+ connman_network_set_maxspeed(network, maxspeed);
+ set_connection_mode(network, maxspeed);
+
+ connman_network_unref(network);
}
static int network_signalpoll(struct wifi_data *wifi)
if (!wifi || !wifi->network)
return -ENODEV;
+ wifi->network = connman_network_ref(wifi->network);
+
interface = wifi->interface;
network = wifi->network;
if (ret < 0) {
DBG("Fail to get max speed !!");
wifi->automaxspeed_timeout = 0;
+ connman_network_unref(wifi->network);
return FALSE;
}