all: fix various warnings detected with coverity
https://bugzilla.gnome.org/show_bug.cgi?id=728320 Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
@@ -699,7 +699,7 @@ parse_output_fields (const char *fields_str,
|
|||||||
if (found) {
|
if (found) {
|
||||||
/* Add index to array, and field name (or NULL) to group_fields array */
|
/* Add index to array, and field name (or NULL) to group_fields array */
|
||||||
g_array_append_val (array, idx);
|
g_array_append_val (array, idx);
|
||||||
if (*group_fields)
|
if (group_fields && *group_fields)
|
||||||
g_ptr_array_add (*group_fields, g_strdup (right));
|
g_ptr_array_add (*group_fields, g_strdup (right));
|
||||||
}
|
}
|
||||||
if (right)
|
if (right)
|
||||||
|
@@ -402,11 +402,8 @@ out:
|
|||||||
if (slot)
|
if (slot)
|
||||||
PK11_FreeSlot (slot);
|
PK11_FreeSlot (slot);
|
||||||
|
|
||||||
if (padded_buf) {
|
memset (padded_buf, 0, padded_buf_len);
|
||||||
memset (padded_buf, 0, padded_buf_len);
|
g_free (padded_buf);
|
||||||
g_free (padded_buf);
|
|
||||||
padded_buf = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
memset (output, 0, output_len);
|
memset (output, 0, output_len);
|
||||||
|
@@ -492,8 +492,6 @@ nm_setting_ip4_config_add_address_with_label (NMSettingIP4Config *setting,
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy = nm_ip4_address_dup (address);
|
copy = nm_ip4_address_dup (address);
|
||||||
g_return_val_if_fail (copy != NULL, FALSE);
|
|
||||||
|
|
||||||
priv->addresses = g_slist_append (priv->addresses, copy);
|
priv->addresses = g_slist_append (priv->addresses, copy);
|
||||||
priv->address_labels = g_slist_append (priv->address_labels, g_strdup (label));
|
priv->address_labels = g_slist_append (priv->address_labels, g_strdup (label));
|
||||||
|
|
||||||
@@ -645,8 +643,6 @@ nm_setting_ip4_config_add_route (NMSettingIP4Config *setting,
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy = nm_ip4_route_dup (route);
|
copy = nm_ip4_route_dup (route);
|
||||||
g_return_val_if_fail (copy != NULL, FALSE);
|
|
||||||
|
|
||||||
priv->routes = g_slist_append (priv->routes, copy);
|
priv->routes = g_slist_append (priv->routes, copy);
|
||||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
|
g_object_notify (G_OBJECT (setting), NM_SETTING_IP4_CONFIG_ROUTES);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -490,8 +490,6 @@ nm_setting_ip6_config_add_address (NMSettingIP6Config *setting,
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy = nm_ip6_address_dup (address);
|
copy = nm_ip6_address_dup (address);
|
||||||
g_return_val_if_fail (copy != NULL, FALSE);
|
|
||||||
|
|
||||||
priv->addresses = g_slist_append (priv->addresses, copy);
|
priv->addresses = g_slist_append (priv->addresses, copy);
|
||||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
|
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ADDRESSES);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -633,8 +631,6 @@ nm_setting_ip6_config_add_route (NMSettingIP6Config *setting,
|
|||||||
}
|
}
|
||||||
|
|
||||||
copy = nm_ip6_route_dup (route);
|
copy = nm_ip6_route_dup (route);
|
||||||
g_return_val_if_fail (copy != NULL, FALSE);
|
|
||||||
|
|
||||||
priv->routes = g_slist_append (priv->routes, copy);
|
priv->routes = g_slist_append (priv->routes, copy);
|
||||||
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
|
g_object_notify (G_OBJECT (setting), NM_SETTING_IP6_CONFIG_ROUTES);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -1140,8 +1140,6 @@ fail:
|
|||||||
nm_log_err (LOGD_CORE, "Failed asserting path component: NULL");
|
nm_log_err (LOGD_CORE, "Failed asserting path component: NULL");
|
||||||
else
|
else
|
||||||
nm_log_err (LOGD_CORE, "Failed asserting path component: \"%s\"", name);
|
nm_log_err (LOGD_CORE, "Failed asserting path component: \"%s\"", name);
|
||||||
g_assert_not_reached ();
|
g_error ("FATAL: Failed asserting path component: %s", name ? name : "(null)");
|
||||||
g_return_val_if_reached ("XXXXX");
|
|
||||||
return "XXXXX";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -119,7 +119,6 @@ constructor (GType type,
|
|||||||
GObject *object;
|
GObject *object;
|
||||||
GObjectClass *klass;
|
GObjectClass *klass;
|
||||||
NMDeviceOlpcMesh *self;
|
NMDeviceOlpcMesh *self;
|
||||||
NMDeviceOlpcMeshPrivate *priv;
|
|
||||||
NMDeviceWifiCapabilities caps;
|
NMDeviceWifiCapabilities caps;
|
||||||
|
|
||||||
klass = G_OBJECT_CLASS (nm_device_olpc_mesh_parent_class);
|
klass = G_OBJECT_CLASS (nm_device_olpc_mesh_parent_class);
|
||||||
@@ -128,7 +127,6 @@ constructor (GType type,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
self = NM_DEVICE_OLPC_MESH (object);
|
self = NM_DEVICE_OLPC_MESH (object);
|
||||||
priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
nm_log_dbg (LOGD_HW | LOGD_OLPC_MESH, "(%s): kernel ifindex %d",
|
nm_log_dbg (LOGD_HW | LOGD_OLPC_MESH, "(%s): kernel ifindex %d",
|
||||||
nm_device_get_iface (NM_DEVICE (self)),
|
nm_device_get_iface (NM_DEVICE (self)),
|
||||||
|
@@ -259,12 +259,13 @@ get_credentials (char *username, char *password)
|
|||||||
size_t len;
|
size_t len;
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
|
|
||||||
if (username && !password) {
|
if (!password) {
|
||||||
/* pppd is checking pap support; return 1 for supported */
|
/* pppd is checking pap support; return 1 for supported */
|
||||||
|
g_return_val_if_fail (username, -1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_return_val_if_fail (username && password, -1);
|
g_return_val_if_fail (username, -1);
|
||||||
g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), -1);
|
g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), -1);
|
||||||
|
|
||||||
g_message ("nm-ppp-plugin: (%s): passwd-hook, requesting credentials...", __func__);
|
g_message ("nm-ppp-plugin: (%s): passwd-hook, requesting credentials...", __func__);
|
||||||
|
@@ -50,11 +50,8 @@ expected_key_new (const char *key, const char *data)
|
|||||||
ExpectedKey *k;
|
ExpectedKey *k;
|
||||||
|
|
||||||
k = g_malloc0 (sizeof (ExpectedKey));
|
k = g_malloc0 (sizeof (ExpectedKey));
|
||||||
g_assert (k);
|
|
||||||
k->key = g_strdup (key);
|
k->key = g_strdup (key);
|
||||||
g_assert (k->key);
|
|
||||||
k->data = g_strdup (data);
|
k->data = g_strdup (data);
|
||||||
g_assert (k->data);
|
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,11 +105,7 @@ expected_block_add_key (ExpectedBlock *b, ExpectedKey *k)
|
|||||||
static Expected *
|
static Expected *
|
||||||
expected_new (void)
|
expected_new (void)
|
||||||
{
|
{
|
||||||
Expected *e;
|
return g_malloc0 (sizeof (Expected));
|
||||||
|
|
||||||
e = g_malloc0 (sizeof (Expected));
|
|
||||||
g_assert (e);
|
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -349,7 +349,10 @@ nm_editor_utils_create_connection (GType type,
|
|||||||
slave_setting_type = types[i]->slave_setting_type;
|
slave_setting_type = types[i]->slave_setting_type;
|
||||||
|
|
||||||
}
|
}
|
||||||
g_return_val_if_fail (type_data != NULL, NULL);
|
if (!type_data) {
|
||||||
|
g_return_val_if_reached (NULL);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
connection = nm_connection_new ();
|
connection = nm_connection_new ();
|
||||||
|
|
||||||
|
@@ -255,6 +255,7 @@ main (int argc, char **argv)
|
|||||||
nm_settings = nm_remote_settings_new (NULL);
|
nm_settings = nm_remote_settings_new (NULL);
|
||||||
g_signal_connect (nm_settings, NM_REMOTE_SETTINGS_CONNECTIONS_READ,
|
g_signal_connect (nm_settings, NM_REMOTE_SETTINGS_CONNECTIONS_READ,
|
||||||
G_CALLBACK (connections_read), &got_connections);
|
G_CALLBACK (connections_read), &got_connections);
|
||||||
|
/* coverity[loop_condition] */
|
||||||
while (!got_connections)
|
while (!got_connections)
|
||||||
g_main_context_iteration (NULL, TRUE);
|
g_main_context_iteration (NULL, TRUE);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user