mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-11 00:10:33 +01:00
Merge branch 'th/bg728320_coverity'
Fix bugs (memory leaks and potential crashes), found using coverity. https://bugzilla.gnome.org/show_bug.cgi?id=728320 Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
commit
6ba897120c
5 changed files with 14 additions and 10 deletions
|
|
@ -559,13 +559,13 @@ get_duid (NMDHCPClient *client)
|
|||
if (leasefile) {
|
||||
nm_log_dbg (LOGD_DHCP, "Looking for DHCPv6 DUID in '%s'.", leasefile);
|
||||
duid = nm_dhcp_dhclient_read_duid (leasefile, &error);
|
||||
g_free (leasefile);
|
||||
|
||||
if (error) {
|
||||
nm_log_warn (LOGD_DHCP, "Failed to read leasefile '%s': (%d) %s",
|
||||
leasefile, error->code, error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
g_free (leasefile);
|
||||
}
|
||||
|
||||
if (!duid && priv->def_leasefile) {
|
||||
|
|
|
|||
|
|
@ -540,7 +540,7 @@ nm_ip6_config_update_setting (const NMIP6Config *config, NMSettingIP6Config *set
|
|||
/* Routes */
|
||||
for (i = 0; i < nroutes; i++) {
|
||||
const NMPlatformIP6Route *route = nm_ip6_config_get_route (config, i);
|
||||
NMIP6Route *s_route = nm_ip6_route_new ();
|
||||
NMIP6Route *s_route;
|
||||
|
||||
/* Ignore link-local route. */
|
||||
if (IN6_IS_ADDR_LINKLOCAL (&route->network))
|
||||
|
|
@ -550,6 +550,7 @@ nm_ip6_config_update_setting (const NMIP6Config *config, NMSettingIP6Config *set
|
|||
if (!route->plen)
|
||||
continue;
|
||||
|
||||
s_route = nm_ip6_route_new ();
|
||||
nm_ip6_route_set_dest (s_route, &route->network);
|
||||
nm_ip6_route_set_prefix (s_route, route->plen);
|
||||
if (!IN6_IS_ADDR_UNSPECIFIED (&route->network))
|
||||
|
|
@ -557,6 +558,7 @@ nm_ip6_config_update_setting (const NMIP6Config *config, NMSettingIP6Config *set
|
|||
nm_ip6_route_set_metric (s_route, route->metric);
|
||||
|
||||
nm_setting_ip6_config_add_route (setting, s_route);
|
||||
nm_ip6_route_unref (s_route);
|
||||
}
|
||||
|
||||
/* DNS */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ svOpenFileInternal (const char *name, gboolean create, GError **error)
|
|||
continue;
|
||||
if (nread <= 0) {
|
||||
errsv = errno;
|
||||
g_free (arena);
|
||||
goto bail;
|
||||
}
|
||||
total += nread;
|
||||
|
|
|
|||
|
|
@ -527,6 +527,7 @@ update_ip4_setting_from_if_block(NMConnection *connection,
|
|||
} else {
|
||||
nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP4 address");
|
||||
}
|
||||
nm_ip4_address_unref (addr);
|
||||
|
||||
nameserver_v = ifparser_getkey (block, "dns-nameserver");
|
||||
ifupdown_ip4_add_dns (s_ip4, nameserver_v);
|
||||
|
|
@ -647,6 +648,7 @@ update_ip6_setting_from_if_block(NMConnection *connection,
|
|||
} else {
|
||||
nm_log_info (LOGD_SETTINGS, "ignoring duplicate IP6 address");
|
||||
}
|
||||
nm_ip6_address_unref (addr);
|
||||
|
||||
nameserver_v = ifparser_getkey(block, "dns-nameserver");
|
||||
ifupdown_ip6_add_dns (s_ip6, nameserver_v);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue