networkd: link - fix memory leak
Make link_initialized() idempotent to avoid taking refs on several udev_device objects.
This commit is contained in:
parent
5347925a59
commit
679b3605f0
|
@ -2122,6 +2122,9 @@ int link_initialized(Link *link, struct udev_device *device) {
|
|||
if (link->state != LINK_STATE_INITIALIZING)
|
||||
return 0;
|
||||
|
||||
if (link->udev_device)
|
||||
return 0;
|
||||
|
||||
log_debug_link(link, "udev initialized link");
|
||||
|
||||
link->udev_device = udev_device_ref(device);
|
||||
|
|
Loading…
Reference in New Issue