3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 04:32:37 +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:
Denis Kenzior 2023-11-26 22:38:44 -06:00 committed by Marcel Holtmann
parent 5ce1c0d001
commit 290f294c60

View File

@ -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)
{
struct l_genl_msg *connect_cmd;
if (!owe_next_group(netdev->owe_sm))
return false;
netdev->connect_cmd = netdev_build_cmd_connect(netdev,
connect_cmd = netdev_build_cmd_connect(netdev,
netdev->handshake, NULL, NULL, 0);
netdev->connect_cmd_id = l_genl_family_send(nl80211,
netdev->connect_cmd,
netdev->connect_cmd_id = l_genl_family_send(nl80211, connect_cmd,
netdev_cmd_connect_cb, netdev,
NULL);
if (!netdev->connect_cmd_id)
return false;
if (netdev->connect_cmd_id > 0)
return true;
netdev->connect_cmd = NULL;
return true;
l_genl_msg_unref(connect_cmd);
return false;
}
static void netdev_connect_event(struct l_genl_msg *msg, struct netdev *netdev)