chiark / gitweb /
networkd: link - fix memory leak
authorTom Gundersen <teg@jklm.no>
Sat, 12 Jul 2014 23:11:52 +0000 (01:11 +0200)
committerTom Gundersen <teg@jklm.no>
Mon, 14 Jul 2014 14:50:01 +0000 (16:50 +0200)
Make link_initialized() idempotent to avoid taking refs on several udev_device
objects.

src/network/networkd-link.c

index 0947b0c..877b7a9 100644 (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);