networkd: link - fix memory leak

Make link_initialized() idempotent to avoid taking refs on several udev_device
objects.
This commit is contained in:
Tom Gundersen
2014-07-14 16:50:01 +02:00
parent 5347925a59
commit 679b3605f0
+3
View File
@@ -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);