mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-20 19:12:33 +01:00
device: Build MDE in a static buffer
Fix a leak of the MDE buffer. It is now only needed for the single call to handshake_state_set_mde which copies the bytes anyway so use a buffer on stack.
This commit is contained in:
parent
7006d18550
commit
1307a815a6
@ -1105,7 +1105,6 @@ void device_connect_network(struct device *device, struct network *network,
|
|||||||
struct l_dbus *dbus = dbus_get_bus();
|
struct l_dbus *dbus = dbus_get_bus();
|
||||||
struct handshake_state *hs;
|
struct handshake_state *hs;
|
||||||
bool add_mde = false;
|
bool add_mde = false;
|
||||||
uint8_t *mde;
|
|
||||||
|
|
||||||
hs = handshake_state_new(netdev_get_ifindex(device->netdev));
|
hs = handshake_state_new(netdev_get_ifindex(device->netdev));
|
||||||
|
|
||||||
@ -1205,7 +1204,7 @@ void device_connect_network(struct device *device, struct network *network,
|
|||||||
add_mde = bss->mde_present;
|
add_mde = bss->mde_present;
|
||||||
|
|
||||||
if (add_mde) {
|
if (add_mde) {
|
||||||
mde = l_malloc(5);
|
uint8_t mde[5];
|
||||||
|
|
||||||
/* The MDE advertised by the BSS must be passed verbatim */
|
/* The MDE advertised by the BSS must be passed verbatim */
|
||||||
mde[0] = IE_TYPE_MOBILITY_DOMAIN;
|
mde[0] = IE_TYPE_MOBILITY_DOMAIN;
|
||||||
@ -1213,8 +1212,7 @@ void device_connect_network(struct device *device, struct network *network,
|
|||||||
memcpy(mde + 2, bss->mde, 3);
|
memcpy(mde + 2, bss->mde, 3);
|
||||||
|
|
||||||
handshake_state_set_mde(hs, mde);
|
handshake_state_set_mde(hs, mde);
|
||||||
} else
|
}
|
||||||
mde = NULL;
|
|
||||||
|
|
||||||
device->connect_pending = l_dbus_message_ref(message);
|
device->connect_pending = l_dbus_message_ref(message);
|
||||||
|
|
||||||
@ -1222,8 +1220,6 @@ void device_connect_network(struct device *device, struct network *network,
|
|||||||
device_connect_cb, device) < 0) {
|
device_connect_cb, device) < 0) {
|
||||||
handshake_state_free(hs);
|
handshake_state_free(hs);
|
||||||
|
|
||||||
l_free(mde);
|
|
||||||
|
|
||||||
dbus_pending_reply(&device->connect_pending,
|
dbus_pending_reply(&device->connect_pending,
|
||||||
dbus_error_failed(device->connect_pending));
|
dbus_error_failed(device->connect_pending));
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user