mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 20:40:21 +01:00
core: Fix leaks if address parsing fails while setting mac
Both 'old' and 'new' are leaked if nl_addr_build() fails to parse the mac address.
This commit is contained in:
parent
360143e42f
commit
74349dcdc3
1 changed files with 2 additions and 0 deletions
|
|
@ -755,6 +755,8 @@ nm_system_iface_set_mac (int ifindex, const struct ether_addr *mac)
|
|||
addr = nl_addr_build (AF_LLC, (void *) mac, ETH_ALEN);
|
||||
if (!addr) {
|
||||
nm_log_err (LOGD_HW, "(%s): failed to allocate memory for MAC address change", iface);
|
||||
rtnl_link_put (old);
|
||||
rtnl_link_put (new);
|
||||
return FALSE;
|
||||
}
|
||||
rtnl_link_set_addr (new, addr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue