mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
netdev: Do not leak l_genl_msg on error
In netdev_retry_owe, if l_gen_family_send fails, the connect_cmd is never freed or reset. Fix that. While here, use a stack variable instead of netdev member, since the use of such a member is unnecessary and confusing.
This commit is contained in:
parent
5ce1c0d001
commit
290f294c60
16
src/netdev.c
16
src/netdev.c
@ -2561,23 +2561,23 @@ static void netdev_cmd_connect_cb(struct l_genl_msg *msg, void *user_data)
|
|||||||
|
|
||||||
static bool netdev_retry_owe(struct netdev *netdev)
|
static bool netdev_retry_owe(struct netdev *netdev)
|
||||||
{
|
{
|
||||||
|
struct l_genl_msg *connect_cmd;
|
||||||
|
|
||||||
if (!owe_next_group(netdev->owe_sm))
|
if (!owe_next_group(netdev->owe_sm))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
netdev->connect_cmd = netdev_build_cmd_connect(netdev,
|
connect_cmd = netdev_build_cmd_connect(netdev,
|
||||||
netdev->handshake, NULL, NULL, 0);
|
netdev->handshake, NULL, NULL, 0);
|
||||||
|
|
||||||
netdev->connect_cmd_id = l_genl_family_send(nl80211,
|
netdev->connect_cmd_id = l_genl_family_send(nl80211, connect_cmd,
|
||||||
netdev->connect_cmd,
|
|
||||||
netdev_cmd_connect_cb, netdev,
|
netdev_cmd_connect_cb, netdev,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!netdev->connect_cmd_id)
|
if (netdev->connect_cmd_id > 0)
|
||||||
return false;
|
return true;
|
||||||
|
|
||||||
netdev->connect_cmd = NULL;
|
l_genl_msg_unref(connect_cmd);
|
||||||
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void netdev_connect_event(struct l_genl_msg *msg, struct netdev *netdev)
|
static void netdev_connect_event(struct l_genl_msg *msg, struct netdev *netdev)
|
||||||
|
Loading…
Reference in New Issue
Block a user