mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 23:09:34 +01:00
netdev: Fix resource leaks in netdev_init
This commit is contained in:
parent
d42c4a57b8
commit
cb57d44cb4
17
src/netdev.c
17
src/netdev.c
@ -4760,8 +4760,6 @@ static int netdev_init(void)
|
|||||||
struct l_genl *genl = iwd_get_genl();
|
struct l_genl *genl = iwd_get_genl();
|
||||||
const struct l_settings *settings = iwd_get_config();
|
const struct l_settings *settings = iwd_get_config();
|
||||||
|
|
||||||
nl80211 = l_genl_family_new(genl, NL80211_GENL_NAME);
|
|
||||||
|
|
||||||
if (rtnl)
|
if (rtnl)
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
|
|
||||||
@ -4779,8 +4777,13 @@ static int netdev_init(void)
|
|||||||
if (!l_netlink_register(rtnl, RTNLGRP_LINK,
|
if (!l_netlink_register(rtnl, RTNLGRP_LINK,
|
||||||
netdev_link_notify, NULL, NULL)) {
|
netdev_link_notify, NULL, NULL)) {
|
||||||
l_error("Failed to register for RTNL link notifications");
|
l_error("Failed to register for RTNL link notifications");
|
||||||
l_netlink_destroy(rtnl);
|
goto fail_netlink;
|
||||||
return -EIO;
|
}
|
||||||
|
|
||||||
|
nl80211 = l_genl_family_new(genl, NL80211_GENL_NAME);
|
||||||
|
if (!nl80211) {
|
||||||
|
l_error("Failed to obtain nl80211");
|
||||||
|
goto fail_netlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!l_settings_get_int(settings, "General", "roam_rssi_threshold",
|
if (!l_settings_get_int(settings, "General", "roam_rssi_threshold",
|
||||||
@ -4808,6 +4811,12 @@ static int netdev_init(void)
|
|||||||
l_error("Registering for MLME notification failed");
|
l_error("Registering for MLME notification failed");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
fail_netlink:
|
||||||
|
l_netlink_destroy(rtnl);
|
||||||
|
rtnl = NULL;
|
||||||
|
|
||||||
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void netdev_exit(void)
|
static void netdev_exit(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user