diff options
author | Dan Winship <danw@redhat.com> | 2015-01-15 10:56:02 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-01-15 14:46:30 -0500 |
commit | bbbbca27787079ab028664f49f7bd1f3a3cad626 (patch) | |
tree | 7f324e4a16a137b3f38274b5286f6305f6732a84 | |
parent | bf7865e8592f012261840662655aca01db0bba06 (diff) | |
download | NetworkManager-bbbbca27787079ab028664f49f7bd1f3a3cad626.tar.gz |
libnm-core: fix a leak in _nm_setting_new_from_dbus()
-rw-r--r-- | libnm-core/nm-setting.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c index 037baa6b58..48317fc7c6 100644 --- a/libnm-core/nm-setting.c +++ b/libnm-core/nm-setting.c @@ -796,7 +796,12 @@ _nm_setting_new_from_dbus (GType setting_type, properties = nm_setting_class_get_properties (class, &n_properties); for (i = 0; i < n_properties; i++) { const NMSettingProperty *property = &properties[i]; - GVariant *value = g_variant_lookup_value (setting_dict, property->name, NULL); + GVariant *value; + + if (property->param_spec && !(property->param_spec->flags & G_PARAM_WRITABLE)) + continue; + + value = g_variant_lookup_value (setting_dict, property->name, NULL); if (value && property->set_func) { property->set_func (setting, @@ -810,9 +815,6 @@ _nm_setting_new_from_dbus (GType setting_type, } else if (value && property->param_spec) { GValue object_value = { 0, }; - if (!(property->param_spec->flags & G_PARAM_WRITABLE)) - continue; - g_value_init (&object_value, property->param_spec->value_type); set_property_from_dbus (property, value, &object_value); g_object_set_property (G_OBJECT (setting), property->param_spec->name, &object_value); |