netdev: Do not leak netdev objects

If the daemon is started and killed rapidly on startup, it is possible
for netdev_shutdown to be called prior to manager processing messages
that actually create the netdev itself.  Since the netdev_list has
already been freed, the storage is lost.  Fix that by destroying
netdev_list only when the module is unloaded.
This commit is contained in:
Denis Kenzior 2021-05-28 22:50:05 -05:00
parent 2b0b5d4173
commit d773c0b4ac
1 changed files with 1 additions and 3 deletions

View File

@ -5959,6 +5959,7 @@ static void netdev_exit(void)
watchlist_destroy(&netdev_watches);
l_queue_destroy(netdev_list, netdev_free);
netdev_list = NULL;
l_genl_family_free(nl80211);
nl80211 = NULL;
@ -5979,9 +5980,6 @@ void netdev_shutdown(void)
netdev_free(netdev);
l_queue_pop_head(netdev_list);
}
l_queue_destroy(netdev_list, NULL);
netdev_list = NULL;
}
IWD_MODULE(netdev, netdev_init, netdev_exit);