if (!dev)
continue;
- device_apply_config(dev, dev->type, blob_memdup(b.head));
+ device_apply_config(dev, dev->type, b.head);
}
dev->default_config = false;
}
case DEV_CONFIG_RESTART:
case DEV_CONFIG_APPLIED:
D(DEVICE, "Device '%s': config applied\n", dev->ifname);
+ config = blob_memdup(config);
free(dev->config);
dev->config = config;
if (change == DEV_CONFIG_RESTART && dev->present) {
break;
case DEV_CONFIG_NO_CHANGE:
D(DEVICE, "Device '%s': no configuration change\n", dev->ifname);
- free(config);
break;
case DEV_CONFIG_RECREATE:
break;
struct device *odev = NULL, *dev;
enum dev_change_type change;
- config = blob_memdup(config);
- if (!config)
- return NULL;
-
odev = device_get(name, false);
if (odev) {
odev->current_config = true;
} else
D(DEVICE, "Create new device '%s' (%s)\n", name, type->name);
+ config = blob_memdup(config);
+ if (!config)
+ return NULL;
+
dev = type->create(name, config);
if (!dev)
return NULL;