ifcfg-rh: fix crash for reading invalid bridge configuration

Error found by coverity.

https://bugzilla.gnome.org/show_bug.cgi?id=728320

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2014-04-15 19:32:48 +02:00
parent 73d4edb0b7
commit 628e774ba8

View File

@@ -215,17 +215,16 @@ make_connection_setting (const char *file,
value = svGetValue (ifcfg, "BRIDGE", FALSE);
if (value) {
const char *bridge;
const char *old_value;
if ((bridge = nm_setting_connection_get_master (s_con))) {
if ((old_value = nm_setting_connection_get_master (s_con))) {
PARSE_WARNING ("Already configured as slave of %s. Ignoring BRIDGE=\"%s\"",
bridge, value);
g_free (value);
old_value, value);
} else {
g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL);
g_object_set (s_con, NM_SETTING_CONNECTION_SLAVE_TYPE,
NM_SETTING_BRIDGE_SETTING_NAME, NULL);
}
g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL);
g_object_set (s_con, NM_SETTING_CONNECTION_SLAVE_TYPE,
NM_SETTING_BRIDGE_SETTING_NAME, NULL);
g_free (value);
}