mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 13:50:15 +01:00
core: fix a warning and a leak
For devices where we don't set the hardware address at construct time, the first call to nm_device_update_hw_address() was hitting a return-if-fail. Also, when updating the hardware address, we were leaking the old value.
This commit is contained in:
parent
2ac34e437f
commit
58a66cc70b
1 changed files with 2 additions and 1 deletions
|
|
@ -6917,7 +6917,8 @@ nm_device_update_hw_address (NMDevice *self)
|
|||
hwaddr = nm_platform_link_get_address (ifindex, &hwaddrlen);
|
||||
g_assert (hwaddrlen <= sizeof (priv->hw_addr));
|
||||
if (hwaddrlen) {
|
||||
if (!nm_utils_hwaddr_matches (priv->hw_addr, -1, hwaddr, hwaddrlen)) {
|
||||
if (!priv->hw_addr || !nm_utils_hwaddr_matches (priv->hw_addr, -1, hwaddr, hwaddrlen)) {
|
||||
g_free (priv->hw_addr);
|
||||
priv->hw_addr = nm_utils_hwaddr_ntoa (hwaddr, hwaddrlen);
|
||||
|
||||
_LOGD (LOGD_HW | LOGD_DEVICE, "hardware address now %s", priv->hw_addr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue