mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-17 17:11:28 +01:00
ifcfg-rh: fix some memory leaks in ifcfg-rh plugin
This commit is contained in:
parent
e116ee9d8a
commit
0937b985da
3 changed files with 17 additions and 5 deletions
|
|
@ -150,6 +150,7 @@ make_connection_setting (const char *file,
|
|||
}
|
||||
}
|
||||
g_free (value);
|
||||
g_strfreev (items);
|
||||
}
|
||||
|
||||
return NM_SETTING (s_con);
|
||||
|
|
@ -294,7 +295,7 @@ fill_ip4_setting_from_ibft (shvarFile *ifcfg,
|
|||
/* Record is good; fill IP4 config with its info */
|
||||
if (!method) {
|
||||
g_warning ("%s: malformed iscsiadm record: missing BOOTPROTO.", __func__);
|
||||
return FALSE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, method, NULL);
|
||||
|
|
@ -305,7 +306,7 @@ fill_ip4_setting_from_ibft (shvarFile *ifcfg,
|
|||
if (!ipaddr.s_addr || !prefix) {
|
||||
g_warning ("%s: malformed iscsiadm record: BOOTPROTO=static "
|
||||
"but missing IP address or prefix.", __func__);
|
||||
return FALSE;
|
||||
goto done;
|
||||
}
|
||||
|
||||
addr = nm_ip4_address_new ();
|
||||
|
|
@ -322,7 +323,8 @@ fill_ip4_setting_from_ibft (shvarFile *ifcfg,
|
|||
|
||||
// FIXME: DNS search domains?
|
||||
}
|
||||
return TRUE;
|
||||
success = TRUE;
|
||||
goto done;
|
||||
}
|
||||
skip = FALSE;
|
||||
hwaddr_matched = FALSE;
|
||||
|
|
@ -1162,6 +1164,7 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||
if (!g_ascii_strcasecmp (value, "bootp") || !g_ascii_strcasecmp (value, "dhcp"))
|
||||
method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
|
||||
else if (!g_ascii_strcasecmp (value, "ibft")) {
|
||||
g_free (value);
|
||||
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default, NULL);
|
||||
/* iSCSI Boot Firmware Table: need to read values from the iSCSI
|
||||
* firmware for this device and create the IP4 setting using those.
|
||||
|
|
@ -1677,6 +1680,7 @@ add_one_wep_key (shvarFile *ifcfg,
|
|||
|
||||
if (key) {
|
||||
nm_setting_wireless_security_set_wep_key (s_wsec, key_idx, key);
|
||||
g_free (key);
|
||||
success = TRUE;
|
||||
} else
|
||||
g_set_error (error, IFCFG_PLUGIN_ERROR, 0, "Invalid WEP key length.");
|
||||
|
|
@ -2809,6 +2813,7 @@ make_wireless_setting (shvarFile *ifcfg,
|
|||
ssid_len = (value_len - 2) / 2;
|
||||
memcpy (buf, tmp, ssid_len);
|
||||
p = &buf[0];
|
||||
g_free (tmp);
|
||||
}
|
||||
|
||||
if (ssid_len > 32 || ssid_len == 0) {
|
||||
|
|
@ -2868,6 +2873,7 @@ make_wireless_setting (shvarFile *ifcfg,
|
|||
if (!eth) {
|
||||
g_set_error (error, IFCFG_PLUGIN_ERROR, 0,
|
||||
"Invalid BSSID '%s'", value);
|
||||
g_free (value);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
@ -2875,6 +2881,7 @@ make_wireless_setting (shvarFile *ifcfg,
|
|||
g_byte_array_append (bssid, eth->ether_addr_octet, ETH_ALEN);
|
||||
g_object_set (s_wireless, NM_SETTING_WIRELESS_BSSID, bssid, NULL);
|
||||
g_byte_array_free (bssid, TRUE);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
value = svGetValue (ifcfg, "CHANNEL", FALSE);
|
||||
|
|
@ -2894,6 +2901,7 @@ make_wireless_setting (shvarFile *ifcfg,
|
|||
g_object_set (s_wireless, NM_SETTING_WIRELESS_BAND, "a", NULL);
|
||||
else
|
||||
g_object_set (s_wireless, NM_SETTING_WIRELESS_BAND, "bg", NULL);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
value = svGetValue (ifcfg, "MTU", FALSE);
|
||||
|
|
@ -2909,6 +2917,7 @@ make_wireless_setting (shvarFile *ifcfg,
|
|||
goto error;
|
||||
}
|
||||
g_object_set (s_wireless, NM_SETTING_WIRELESS_MTU, (guint32) mtu, NULL);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
done:
|
||||
|
|
@ -2971,6 +2980,7 @@ wireless_connection_from_ifcfg (const char *file,
|
|||
/* Wireless security */
|
||||
security_setting = make_wireless_security_setting (ifcfg, file, ssid, adhoc, &s_8021x, error);
|
||||
if (*error) {
|
||||
g_free (printable_ssid);
|
||||
g_object_unref (connection);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -3476,6 +3486,7 @@ connection_from_file (const char *filename,
|
|||
|
||||
g_object_set (G_OBJECT (s_con), NM_SETTING_CONNECTION_READ_ONLY, TRUE, NULL);
|
||||
}
|
||||
g_free (bootproto);
|
||||
|
||||
if (!nm_connection_verify (connection, &error)) {
|
||||
g_object_unref (connection);
|
||||
|
|
|
|||
|
|
@ -296,14 +296,14 @@ svSetValue(shvarFile *s, const char *key, const char *value, gboolean verbatim)
|
|||
if (s->current) s->current->data = keyValue;
|
||||
else s->lineList = g_list_append(s->lineList, keyValue);
|
||||
s->modified = 1;
|
||||
goto end;
|
||||
} else if (val1) {
|
||||
/* delete line */
|
||||
s->lineList = g_list_remove_link(s->lineList, s->current);
|
||||
g_list_free_1(s->current);
|
||||
s->modified = 1;
|
||||
goto bail; /* do not need keyValue */
|
||||
}
|
||||
goto end;
|
||||
goto bail; /* do not need keyValue */
|
||||
}
|
||||
|
||||
if (!val1) {
|
||||
|
|
|
|||
|
|
@ -354,6 +354,7 @@ write_object (NMSetting8021x *s_8021x,
|
|||
success = write_secret_file (new_file, (const char *) blob->data, blob->len, &write_error);
|
||||
if (success) {
|
||||
svSetValue (ifcfg, objtype->ifcfg_key, new_file, FALSE);
|
||||
g_free (new_file);
|
||||
return TRUE;
|
||||
} else {
|
||||
g_set_error (error, IFCFG_PLUGIN_ERROR, 0,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue