mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-21 12:20:43 +01:00
monitor: Fix potential memory leak
In case l_netlink object was not created successfully, rtmmsg would leak.
This commit is contained in:
parent
34560120f9
commit
39bb4d07ee
@ -221,6 +221,12 @@ static struct l_netlink *rtm_interface_send_message(struct l_netlink *rtnl,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!rtnl)
|
||||||
|
rtnl = l_netlink_new(NETLINK_ROUTE);
|
||||||
|
|
||||||
|
if (!rtnl)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
bufsize = NLMSG_LENGTH(sizeof(struct ifinfomsg)) +
|
bufsize = NLMSG_LENGTH(sizeof(struct ifinfomsg)) +
|
||||||
RTA_SPACE(ifname_len) + RTA_SPACE(0) +
|
RTA_SPACE(ifname_len) + RTA_SPACE(0) +
|
||||||
RTA_SPACE(nlmon_type_len);
|
RTA_SPACE(nlmon_type_len);
|
||||||
@ -231,12 +237,6 @@ static struct l_netlink *rtm_interface_send_message(struct l_netlink *rtnl,
|
|||||||
rtmmsg->ifi_family = AF_UNSPEC;
|
rtmmsg->ifi_family = AF_UNSPEC;
|
||||||
rtmmsg->ifi_change = ~0;
|
rtmmsg->ifi_change = ~0;
|
||||||
|
|
||||||
if (!rtnl)
|
|
||||||
rtnl = l_netlink_new(NETLINK_ROUTE);
|
|
||||||
|
|
||||||
if (!rtnl)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
rta_buf = rtmmsg + 1;
|
rta_buf = rtmmsg + 1;
|
||||||
|
|
||||||
if (ifname)
|
if (ifname)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user