3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 03:32:42 +01:00

device: Avoid leaking memory

In case we bail out early when setting up the RSN element
This commit is contained in:
Denis Kenzior 2016-11-02 16:42:12 -05:00
parent e6311557fe
commit 2340c7790c

View File

@ -649,12 +649,6 @@ void device_connect_network(struct device *device, struct network *network,
uint8_t rsne_buf[256]; uint8_t rsne_buf[256];
struct ie_rsn_info info; struct ie_rsn_info info;
sm = eapol_sm_new();
eapol_sm_set_authenticator_address(sm, bss->addr);
eapol_sm_set_supplicant_address(sm,
netdev_get_address(device->netdev));
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
if (security == SECURITY_PSK) if (security == SECURITY_PSK)
@ -682,6 +676,12 @@ void device_connect_network(struct device *device, struct network *network,
} else if (info.group_management_cipher != 0) } else if (info.group_management_cipher != 0)
info.mfpc = true; info.mfpc = true;
sm = eapol_sm_new();
eapol_sm_set_authenticator_address(sm, bss->addr);
eapol_sm_set_supplicant_address(sm,
netdev_get_address(device->netdev));
/* RSN takes priority */ /* RSN takes priority */
if (bss->rsne) { if (bss->rsne) {
ie_build_rsne(&info, rsne_buf); ie_build_rsne(&info, rsne_buf);