summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-07-13 01:11:52 +0200
committerTom Gundersen <teg@jklm.no>2014-07-14 16:50:01 +0200
commit679b3605f0ea52ee56ae76e57dfd17bcfef5b122 (patch)
treecb1d412ccff4c08d777a347b6e3d879d1326eb37
parent5347925a59530bd4e6616eb8c8d43a02c3e14c46 (diff)
networkd: link - fix memory leak
Make link_initialized() idempotent to avoid taking refs on several udev_device objects.
-rw-r--r--src/network/networkd-link.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 0947b0c905..877b7a9be2 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -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);