Commit 58a66cc7 authored by Dan Winship's avatar Dan Winship
Browse files

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

Also, when updating the hardware address, we were leaking the old
parent 2ac34e43
......@@ -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);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment