only free unused devices after the final config init
[project/netifd.git] / device.c
index bceba62..5b27ce0 100644 (file)
--- a/device.c
+++ b/device.c
@@ -292,7 +292,7 @@ void device_add_user(struct device_user *dep, struct device *dev)
 static void
 __device_free_unused(struct device *dev)
 {
-       if (!list_empty(&dev->users) || dev->current_config)
+       if (!list_empty(&dev->users) || dev->current_config || config_init)
                return;
 
        device_free(dev);