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-13 01:11:52 +02:00
parent 5347925a59
commit 679b3605f0
1 changed files with 3 additions and 0 deletions

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);