device: Unregister netdev watch in device_free

This commit is contained in:
Andrew Zaborowski 2016-07-13 04:29:51 +02:00 committed by Denis Kenzior
parent 07f177ca24
commit 6fbc9d59cc
1 changed files with 5 additions and 1 deletions

View File

@ -70,6 +70,7 @@ struct device {
struct l_dbus_message *connect_pending;
struct l_dbus_message *disconnect_pending;
bool scanning;
uint32_t netdev_watch_id;
struct wiphy *wiphy;
struct netdev *netdev;
@ -1103,7 +1104,8 @@ struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)
scan_ifindex_add(device->index);
device_netdev_notify(netdev, netdev_get_is_up(netdev), device);
netdev_watch_add(netdev, device_netdev_notify, device);
device->netdev_watch_id =
netdev_watch_add(netdev, device_netdev_notify, device);
return device;
}
@ -1136,6 +1138,8 @@ static void device_free(void *user)
l_queue_destroy(device->old_bss_list, bss_free);
l_queue_destroy(device->autoconnect_list, l_free);
netdev_watch_remove(device->netdev, device->netdev_watch_id);
scan_ifindex_remove(device->index);
l_free(device);
}