Commit e21429ea authored by Christian Kellner's avatar Christian Kellner
Browse files

device: proper memory handling in setters

Also ensure that dev->uid well only be set once, since it must
never change.
parent 3364a589
......@@ -169,14 +169,17 @@ bolt_device_set_property (GObject *object,
switch (prop_id)
{
case PROP_UID:
g_return_if_fail (dev->uid == NULL);
dev->uid = g_value_dup_string (value);
break;
case PROP_NAME:
g_clear_pointer (&dev->name, g_free);
dev->name = g_value_dup_string (value);
break;
case PROP_VENDOR:
g_clear_pointer (&dev->vendor, g_free);
dev->vendor = g_value_dup_string (value);
break;
......@@ -185,6 +188,7 @@ bolt_device_set_property (GObject *object,
break;
case PROP_SYSFS:
g_clear_pointer (&dev->syspath, g_free);
dev->syspath = g_value_dup_string (value);
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment