From 08f04466e88915997c33a0b7e2da2b5d5f044285 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 31 Jan 2013 15:36:12 -0500 Subject: [PATCH] all: remove more pointless NULL checks GObject creation cannot normally fail, except for types that implement GInitable and take a GError in their _new() method. Some NM types override constructor() and return NULL in some cases, but these generally only happen in the case of programmer error (eg, failing to set a mandatory property), and so crashing is reasonable (and most likely inevitable anyway). So, remove all NULL checks after calls to g_object_new() and its myriad wrappers. https://bugzilla.gnome.org/show_bug.cgi?id=693678 --- libnm-util/tests/test-secrets.c | 28 -- src/dnsmasq-manager/nm-dnsmasq-manager.c | 2 - src/ip6-manager/nm-ip6-manager.c | 5 - src/nm-device-ethernet.c | 2 - src/settings/nm-default-wired-connection.c | 43 +- src/settings/nm-inotify-helper.c | 11 +- src/settings/nm-secret-agent.c | 32 +- src/settings/nm-settings.c | 2 - .../plugins/example/nm-example-connection.c | 3 - src/settings/plugins/example/plugin.c | 8 +- src/settings/plugins/ifcfg-rh/plugin.c | 14 +- src/settings/plugins/ifcfg-rh/reader.c | 40 -- .../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 427 ------------------ .../plugins/ifnet/connection_parser.c | 7 - .../plugins/ifnet/nm-ifnet-connection.c | 5 - src/settings/plugins/ifnet/plugin.c | 6 +- src/settings/plugins/ifupdown/plugin.c | 6 +- .../plugins/keyfile/nm-keyfile-connection.c | 2 - src/settings/plugins/keyfile/plugin.c | 10 +- .../plugins/keyfile/tests/test-keyfile.c | 78 ---- .../nm-supplicant-interface.c | 28 +- .../tests/test-supplicant-config.c | 45 -- src/vpn-manager/nm-vpn-service.c | 5 - src/wimax/nm-wimax-factory.c | 7 +- 24 files changed, 68 insertions(+), 748 deletions(-) diff --git a/libnm-util/tests/test-secrets.c b/libnm-util/tests/test-secrets.c index 0e859abcc..43156f100 100644 --- a/libnm-util/tests/test-secrets.c +++ b/libnm-util/tests/test-secrets.c @@ -67,14 +67,9 @@ make_tls_connection (const char *detail, NMSetting8021xCKScheme scheme) GError *error = NULL; connection = nm_connection_new (); - ASSERT (connection != NULL, - detail, "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -88,16 +83,10 @@ make_tls_connection (const char *detail, NMSetting8021xCKScheme scheme) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* Wireless security setting */ s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_802_1X_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_8021x)); g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, "Bill Smith", NULL); @@ -134,9 +123,6 @@ make_tls_connection (const char *detail, NMSetting8021xCKScheme scheme) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); @@ -247,14 +233,9 @@ make_tls_phase2_connection (const char *detail, NMSetting8021xCKScheme scheme) GError *error = NULL; connection = nm_connection_new (); - ASSERT (connection != NULL, - detail, "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -268,16 +249,10 @@ make_tls_phase2_connection (const char *detail, NMSetting8021xCKScheme scheme) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* Wireless security setting */ s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_802_1X_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_8021x)); g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, "blahblah", NULL); @@ -316,9 +291,6 @@ make_tls_phase2_connection (const char *detail, NMSetting8021xCKScheme scheme) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); diff --git a/src/dnsmasq-manager/nm-dnsmasq-manager.c b/src/dnsmasq-manager/nm-dnsmasq-manager.c index f708f6f6c..df190dcf9 100644 --- a/src/dnsmasq-manager/nm-dnsmasq-manager.c +++ b/src/dnsmasq-manager/nm-dnsmasq-manager.c @@ -112,8 +112,6 @@ nm_dnsmasq_manager_new (const char *iface) NMDnsMasqManagerPrivate *priv; manager = (NMDnsMasqManager *) g_object_new (NM_TYPE_DNSMASQ_MANAGER, NULL); - if (!manager) - return NULL; priv = NM_DNSMASQ_MANAGER_GET_PRIVATE (manager); priv->iface = g_strdup (iface); diff --git a/src/ip6-manager/nm-ip6-manager.c b/src/ip6-manager/nm-ip6-manager.c index 91822caaa..c9f3090e7 100644 --- a/src/ip6-manager/nm-ip6-manager.c +++ b/src/ip6-manager/nm-ip6-manager.c @@ -1496,11 +1496,6 @@ nm_ip6_manager_get_ip6_config (NMIP6Manager *manager, int ifindex) } config = nm_ip6_config_new (); - if (!config) { - nm_log_err (LOGD_IP6, "(%s): out of memory creating IP6 config object.", - device->iface); - return NULL; - } /* Make sure we refill the route and address caches, otherwise we won't get * up-to-date information here since the netlink route/addr change messages diff --git a/src/nm-device-ethernet.c b/src/nm-device-ethernet.c index cf4541db1..16c88d5b1 100644 --- a/src/nm-device-ethernet.c +++ b/src/nm-device-ethernet.c @@ -800,8 +800,6 @@ build_supplicant_config (NMDeviceEthernet *self) con_uuid = nm_connection_get_uuid (connection); config = nm_supplicant_config_new (); - if (!config) - return NULL; security = nm_connection_get_setting_802_1x (connection); if (!nm_supplicant_config_add_setting_8021x (config, security, con_uuid, TRUE)) { diff --git a/src/settings/nm-default-wired-connection.c b/src/settings/nm-default-wired-connection.c index 9cbfc7608..ff817b58b 100644 --- a/src/settings/nm-default-wired-connection.c +++ b/src/settings/nm-default-wired-connection.c @@ -110,32 +110,31 @@ nm_default_wired_connection_new (const GByteArray *mac, g_return_val_if_fail (defname != NULL, NULL); self = (NMDefaultWiredConnection *) g_object_new (NM_TYPE_DEFAULT_WIRED_CONNECTION, NULL); - if (self) { - priv = NM_DEFAULT_WIRED_CONNECTION_GET_PRIVATE (self); - priv->device = g_object_ref (device); - priv->mac = g_byte_array_sized_new (ETH_ALEN); - g_byte_array_append (priv->mac, mac->data, mac->len); - setting = nm_setting_connection_new (); + priv = NM_DEFAULT_WIRED_CONNECTION_GET_PRIVATE (self); + priv->device = g_object_ref (device); + priv->mac = g_byte_array_sized_new (ETH_ALEN); + g_byte_array_append (priv->mac, mac->data, mac->len); - uuid = nm_utils_uuid_generate (); - g_object_set (setting, - NM_SETTING_CONNECTION_ID, defname, - NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME, - NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, - NM_SETTING_CONNECTION_UUID, uuid, - NM_SETTING_CONNECTION_READ_ONLY, read_only, - NM_SETTING_CONNECTION_TIMESTAMP, (guint64) time (NULL), - NULL); - g_free (uuid); + setting = nm_setting_connection_new (); - nm_connection_add_setting (NM_CONNECTION (self), setting); + uuid = nm_utils_uuid_generate (); + g_object_set (setting, + NM_SETTING_CONNECTION_ID, defname, + NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME, + NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, + NM_SETTING_CONNECTION_UUID, uuid, + NM_SETTING_CONNECTION_READ_ONLY, read_only, + NM_SETTING_CONNECTION_TIMESTAMP, (guint64) time (NULL), + NULL); + g_free (uuid); - /* Lock the connection to the specific device */ - setting = nm_setting_wired_new (); - g_object_set (setting, NM_SETTING_WIRED_MAC_ADDRESS, priv->mac, NULL); - nm_connection_add_setting (NM_CONNECTION (self), setting); - } + nm_connection_add_setting (NM_CONNECTION (self), setting); + + /* Lock the connection to the specific device */ + setting = nm_setting_wired_new (); + g_object_set (setting, NM_SETTING_WIRED_MAC_ADDRESS, priv->mac, NULL); + nm_connection_add_setting (NM_CONNECTION (self), setting); return self; } diff --git a/src/settings/nm-inotify-helper.c b/src/settings/nm-inotify-helper.c index 2391d993b..2d4a38472 100644 --- a/src/settings/nm-inotify-helper.c +++ b/src/settings/nm-inotify-helper.c @@ -133,13 +133,6 @@ init_inotify (NMInotifyHelper *self) /* Watch the inotify descriptor for file/directory change events */ channel = g_io_channel_unix_new (priv->ifd); - if (!channel) { - nm_log_warn (LOGD_SETTINGS, "couldn't create new GIOChannel"); - close (priv->ifd); - priv->ifd = -1; - return FALSE; - } - g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL); g_io_channel_set_encoding (channel, NULL, NULL); @@ -158,11 +151,9 @@ nm_inotify_helper_get (void) if (!singleton) { singleton = (NMInotifyHelper *) g_object_new (NM_TYPE_INOTIFY_HELPER, NULL); - if (!singleton) - return NULL; if (!init_inotify (singleton)) { - g_object_unref (singleton); + g_clear_object (&singleton); return NULL; } } else diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c index e79d4281e..6bbaf6d77 100644 --- a/src/settings/nm-secret-agent.c +++ b/src/settings/nm-secret-agent.c @@ -445,26 +445,24 @@ nm_secret_agent_new (NMDBusManager *dbus_mgr, username = g_strdup (pw->pw_name); self = (NMSecretAgent *) g_object_new (NM_TYPE_SECRET_AGENT, NULL); - if (self) { - priv = NM_SECRET_AGENT_GET_PRIVATE (self); + priv = NM_SECRET_AGENT_GET_PRIVATE (self); - priv->owner = g_strdup (owner); - priv->identifier = g_strdup (identifier); - priv->owner_uid = owner_uid; - priv->owner_username = g_strdup (username); + priv->owner = g_strdup (owner); + priv->identifier = g_strdup (identifier); + priv->owner_uid = owner_uid; + priv->owner_username = g_strdup (username); - hash_str = g_strdup_printf ("%08u%s", owner_uid, identifier); - priv->hash = g_str_hash (hash_str); - g_free (hash_str); + hash_str = g_strdup_printf ("%08u%s", owner_uid, identifier); + priv->hash = g_str_hash (hash_str); + g_free (hash_str); - priv->dbus_mgr = g_object_ref (dbus_mgr); - bus = nm_dbus_manager_get_connection (priv->dbus_mgr); - priv->proxy = dbus_g_proxy_new_for_name (bus, - owner, - NM_DBUS_PATH_SECRET_AGENT, - NM_DBUS_INTERFACE_SECRET_AGENT); - g_assert (priv->proxy); - } + priv->dbus_mgr = g_object_ref (dbus_mgr); + bus = nm_dbus_manager_get_connection (priv->dbus_mgr); + priv->proxy = dbus_g_proxy_new_for_name (bus, + owner, + NM_DBUS_PATH_SECRET_AGENT, + NM_DBUS_INTERFACE_SECRET_AGENT); + g_assert (priv->proxy); g_free (username); return self; diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index f68331a7d..b04016116 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -1752,8 +1752,6 @@ nm_settings_new (const char *config_file, NMSettingsPrivate *priv; self = g_object_new (NM_TYPE_SETTINGS, NULL); - if (!self) - return NULL; priv = NM_SETTINGS_GET_PRIVATE (self); diff --git a/src/settings/plugins/example/nm-example-connection.c b/src/settings/plugins/example/nm-example-connection.c index e4a69f9b0..17fd27f0f 100644 --- a/src/settings/plugins/example/nm-example-connection.c +++ b/src/settings/plugins/example/nm-example-connection.c @@ -71,9 +71,6 @@ nm_example_connection_new (const char *full_path, /* Actually create the new NMExampleConnection object */ object = (GObject *) g_object_new (NM_TYPE_EXAMPLE_CONNECTION, NULL); - if (!object) - goto out; - priv = NM_EXAMPLE_CONNECTION_GET_PRIVATE (object); priv->path = g_strdup (full_path); diff --git a/src/settings/plugins/example/plugin.c b/src/settings/plugins/example/plugin.c index 04af03e74..05ac9290a 100644 --- a/src/settings/plugins/example/plugin.c +++ b/src/settings/plugins/example/plugin.c @@ -852,12 +852,10 @@ nm_system_config_factory (const char *config_file) if (!singleton) { /* Instantiate our plugin */ singleton = SC_PLUGIN_EXAMPLE (g_object_new (SC_TYPE_PLUGIN_EXAMPLE, NULL)); - if (singleton) { - priv = SC_PLUGIN_EXAMPLE_GET_PRIVATE (singleton); + priv = SC_PLUGIN_EXAMPLE_GET_PRIVATE (singleton); - /* Cache the config file path */ - priv->conf_file = g_strdup (config_file); - } + /* Cache the config file path */ + priv->conf_file = g_strdup (config_file); } else { /* This function should never be called twice */ g_assert_not_reached (); diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c index 50cbdf072..7b6891565 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.c +++ b/src/settings/plugins/ifcfg-rh/plugin.c @@ -859,14 +859,12 @@ nm_system_config_factory (const char *config_file) if (!singleton) { singleton = SC_PLUGIN_IFCFG (g_object_new (SC_TYPE_PLUGIN_IFCFG, NULL)); - if (singleton) { - priv = SC_PLUGIN_IFCFG_GET_PRIVATE (singleton); - if (priv->bus) - dbus_g_connection_register_g_object (priv->bus, - DBUS_OBJECT_PATH, - G_OBJECT (singleton)); - PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "Acquired D-Bus service %s", DBUS_SERVICE_NAME); - } + priv = SC_PLUGIN_IFCFG_GET_PRIVATE (singleton); + if (priv->bus) + dbus_g_connection_register_g_object (priv->bus, + DBUS_OBJECT_PATH, + G_OBJECT (singleton)); + PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "Acquired D-Bus service %s", DBUS_SERVICE_NAME); } else g_object_ref (singleton); diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index bbe834360..6205057b1 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -1195,11 +1195,6 @@ make_ip4_setting (shvarFile *ifcfg, gboolean never_default = FALSE, tmp_success; s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - if (!s_ip4) { - g_set_error (error, IFCFG_PLUGIN_ERROR, 0, - "Could not allocate IP4 setting"); - return NULL; - } /* First check if DEFROUTE is set for this device; DEFROUTE has the * opposite meaning from never-default. The default if DEFROUTE is not @@ -1496,11 +1491,6 @@ make_ip6_setting (shvarFile *ifcfg, NMSettingIP6ConfigPrivacy ip6_privacy_val; s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - if (!s_ip6) { - g_set_error (error, IFCFG_PLUGIN_ERROR, 0, - "Could not allocate IP6 setting"); - return NULL; - } /* First check if IPV6_DEFROUTE is set for this device; IPV6_DEFROUTE has the * opposite meaning from never-default. The default if IPV6_DEFROUTE is not @@ -3198,11 +3188,6 @@ wireless_connection_from_ifcfg (const char *file, g_return_val_if_fail (*error == NULL, NULL); connection = nm_connection_new (); - if (!connection) { - g_set_error (error, IFCFG_PLUGIN_ERROR, 0, - "Failed to allocate new connection for %s.", file); - return NULL; - } /* Wireless */ wireless_setting = make_wireless_setting (ifcfg, nm_controlled, unmanaged, error); @@ -3476,11 +3461,6 @@ wired_connection_from_ifcfg (const char *file, g_return_val_if_fail (ifcfg != NULL, NULL); connection = nm_connection_new (); - if (!connection) { - g_set_error (error, IFCFG_PLUGIN_ERROR, 0, - "Failed to allocate new connection for %s.", file); - return NULL; - } con_setting = make_connection_setting (file, ifcfg, NM_SETTING_WIRED_SETTING_NAME, NULL, NULL); if (!con_setting) { @@ -3584,11 +3564,6 @@ infiniband_connection_from_ifcfg (const char *file, g_return_val_if_fail (ifcfg != NULL, NULL); connection = nm_connection_new (); - if (!connection) { - g_set_error (error, IFCFG_PLUGIN_ERROR, 0, - "Failed to allocate new connection for %s.", file); - return NULL; - } con_setting = make_connection_setting (file, ifcfg, NM_SETTING_INFINIBAND_SETTING_NAME, NULL, NULL); if (!con_setting) { @@ -3693,11 +3668,6 @@ bond_connection_from_ifcfg (const char *file, g_return_val_if_fail (ifcfg != NULL, NULL); connection = nm_connection_new (); - if (!connection) { - g_set_error (error, IFCFG_PLUGIN_ERROR, 0, - "Failed to allocate new connection for %s.", file); - return NULL; - } con_setting = make_connection_setting (file, ifcfg, NM_SETTING_BOND_SETTING_NAME, NULL, _("Bond")); if (!con_setting) { @@ -3878,11 +3848,6 @@ bridge_connection_from_ifcfg (const char *file, g_return_val_if_fail (ifcfg != NULL, NULL); connection = nm_connection_new (); - if (!connection) { - g_set_error (error, IFCFG_PLUGIN_ERROR, 0, - "Failed to allocate new connection for %s.", file); - return NULL; - } con_setting = make_connection_setting (file, ifcfg, NM_SETTING_BRIDGE_SETTING_NAME, NULL, _("Bridge")); if (!con_setting) { @@ -4143,11 +4108,6 @@ vlan_connection_from_ifcfg (const char *file, g_return_val_if_fail (ifcfg != NULL, NULL); connection = nm_connection_new (); - if (!connection) { - g_set_error (error, IFCFG_PLUGIN_ERROR, 0, - "Failed to allocate new connection for %s.", file); - return NULL; - } con_setting = make_connection_setting (file, ifcfg, NM_SETTING_VLAN_SETTING_NAME, NULL, "Vlan"); if (!con_setting) { diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index c1d4063a2..31207e50a 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -101,9 +101,6 @@ verify_cert_or_key (CertKeyType ck_type, /* CA Cert */ s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - test_name, "failed to verify %s: could not create temp 802.1x setting", - ifcfg); if (ck_type == CK_CA_CERT) { if (phase2) @@ -2990,10 +2987,6 @@ test_read_wired_8021x_peap_mschapv2 (void) /* CA Cert */ tmp_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (tmp_8021x != NULL, - "wired-8021x-peap-mschapv2-verify-8021x", "failed to verify %s: could not create temp 802.1x setting", - TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2, - NM_SETTING_802_1X_SETTING_NAME); success = nm_setting_802_1x_set_ca_cert (tmp_8021x, TEST_IFCFG_WIRED_8021x_PEAP_MSCHAPV2_CA_CERT, @@ -6777,14 +6770,9 @@ test_write_wired_static (void) inet_pton (AF_INET6, "cafe:ffff:eeee:dddd:cccc:bbbb:aaaa:feed", &dns6_2); connection = nm_connection_new (); - ASSERT (connection != NULL, - "wired-static-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-static-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -6798,9 +6786,6 @@ test_write_wired_static (void) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - "wired-static-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); mac = g_byte_array_sized_new (sizeof (tmpmac)); @@ -6814,9 +6799,6 @@ test_write_wired_static (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-static-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -6846,9 +6828,6 @@ test_write_wired_static (void) /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-static-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -6981,14 +6960,9 @@ test_write_wired_dhcp (void) gboolean ignore_error = FALSE; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wired-dhcp-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -7002,16 +6976,10 @@ test_write_wired_dhcp (void) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - "wired-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -7028,9 +6996,6 @@ test_write_wired_dhcp (void) /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -7109,14 +7074,9 @@ test_write_wired_static_ip6_only (void) inet_pton (AF_INET6, "fade:0102:0103::face", &dns6); connection = nm_connection_new (); - ASSERT (connection != NULL, - "wired-static-ip6-only-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-static-ip6-only-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -7130,9 +7090,6 @@ test_write_wired_static_ip6_only (void) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - "wired-static-ip6-only-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); mac = g_byte_array_sized_new (sizeof (tmpmac)); @@ -7142,9 +7099,6 @@ test_write_wired_static_ip6_only (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-static-ip6-only-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -7153,9 +7107,6 @@ test_write_wired_static_ip6_only (void) /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-static-ip6-only-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -7407,14 +7358,9 @@ test_write_wired_static_routes (void) gboolean ignore_error = FALSE; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wired-static-routes-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-static-routes-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -7428,9 +7374,6 @@ test_write_wired_static_routes (void) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - "wired-static-routes-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); mac = g_byte_array_sized_new (sizeof (tmpmac)); @@ -7444,9 +7387,6 @@ test_write_wired_static_routes (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-static-routes-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -7491,9 +7431,6 @@ test_write_wired_static_routes (void) /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -7573,14 +7510,9 @@ test_write_wired_dhcp_8021x_peap_mschapv2 (void) gboolean ignore_error = FALSE; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -7594,25 +7526,16 @@ test_write_wired_dhcp_8021x_peap_mschapv2 (void) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -7622,9 +7545,6 @@ test_write_wired_dhcp_8021x_peap_mschapv2 (void) /* 802.1x setting */ s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - "wired-dhcp-8021x-peap-mschapv2write", "failed to allocate new %s setting", - NM_SETTING_802_1X_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_8021x)); g_object_set (s_8021x, @@ -7960,14 +7880,9 @@ test_write_wifi_open (void) char *tmp; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-open-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-open-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -7981,9 +7896,6 @@ test_write_wifi_open (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-open-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -8009,18 +7921,12 @@ test_write_wifi_open (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-open-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-open-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -8113,14 +8019,9 @@ test_write_wifi_open_hex_ssid (void) const unsigned char ssid_data[] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd }; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-open-hex-ssid-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-open-hex-ssid-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -8134,9 +8035,6 @@ test_write_wifi_open_hex_ssid (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-open-hex-ssid-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -8151,18 +8049,12 @@ test_write_wifi_open_hex_ssid (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-open-hex-ssid-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-open-hex-ssid-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -8241,14 +8133,9 @@ test_write_wifi_wep (void) struct stat statbuf; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wep-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wep-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -8262,9 +8149,6 @@ test_write_wifi_wep (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wep-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -8280,9 +8164,6 @@ test_write_wifi_wep (void) /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wep-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, @@ -8297,18 +8178,12 @@ test_write_wifi_wep (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wep-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wep-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -8404,14 +8279,9 @@ test_write_wifi_wep_adhoc (void) const guint32 prefix = 24; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wep-adhoc-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -8425,9 +8295,6 @@ test_write_wifi_wep_adhoc (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -8443,9 +8310,6 @@ test_write_wifi_wep_adhoc (void) /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none", NULL); @@ -8453,9 +8317,6 @@ test_write_wifi_wep_adhoc (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); @@ -8472,9 +8333,6 @@ test_write_wifi_wep_adhoc (void) /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -8565,14 +8423,9 @@ test_write_wifi_wep_passphrase (void) struct stat statbuf; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wep-passphrase-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wep-passphrase-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -8586,9 +8439,6 @@ test_write_wifi_wep_passphrase (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wep-passphrase-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -8604,9 +8454,6 @@ test_write_wifi_wep_passphrase (void) /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wep-passphrase-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, @@ -8619,18 +8466,12 @@ test_write_wifi_wep_passphrase (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wep-passphrase-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wep-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -8721,14 +8562,9 @@ test_write_wifi_wep_40_ascii (void) struct stat statbuf; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -8742,9 +8578,6 @@ test_write_wifi_wep_40_ascii (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -8760,9 +8593,6 @@ test_write_wifi_wep_40_ascii (void) /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, @@ -8777,18 +8607,12 @@ test_write_wifi_wep_40_ascii (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wep-40-ascii-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -8879,14 +8703,9 @@ test_write_wifi_wep_104_ascii (void) struct stat statbuf; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -8900,9 +8719,6 @@ test_write_wifi_wep_104_ascii (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -8918,9 +8734,6 @@ test_write_wifi_wep_104_ascii (void) /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, @@ -8935,18 +8748,12 @@ test_write_wifi_wep_104_ascii (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wep-104-ascii-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -9037,14 +8844,9 @@ test_write_wifi_leap (void) struct stat statbuf; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-leap-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-leap-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -9058,9 +8860,6 @@ test_write_wifi_leap (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-leap-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -9076,9 +8875,6 @@ test_write_wifi_leap (void) /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-leap-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, @@ -9090,18 +8886,12 @@ test_write_wifi_leap (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-leap-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-leap-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -9332,14 +9122,9 @@ test_write_wifi_wpa_psk (const char *name, g_return_if_fail (psk != NULL); connection = nm_connection_new (); - ASSERT (connection != NULL, - test_name, "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - test_name, "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -9353,9 +9138,6 @@ test_write_wifi_wpa_psk (const char *name, /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - test_name, "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -9371,9 +9153,6 @@ test_write_wifi_wpa_psk (const char *name, /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - test_name, "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, @@ -9398,18 +9177,12 @@ test_write_wifi_wpa_psk (const char *name, /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - test_name, "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - test_name, "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -9498,14 +9271,9 @@ test_write_wifi_wpa_psk_adhoc (void) const guint32 prefix = 24; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -9519,9 +9287,6 @@ test_write_wifi_wpa_psk_adhoc (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -9539,9 +9304,6 @@ test_write_wifi_wpa_psk_adhoc (void) /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, @@ -9554,9 +9316,6 @@ test_write_wifi_wpa_psk_adhoc (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NULL); @@ -9573,9 +9332,6 @@ test_write_wifi_wpa_psk_adhoc (void) /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wpa-psk-adhoc-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -9658,14 +9414,9 @@ test_write_wifi_wpa_eap_tls (void) const char *ssid_data = "blahblah"; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -9679,9 +9430,6 @@ test_write_wifi_wpa_eap_tls (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (strlen (ssid_data)); @@ -9697,9 +9445,6 @@ test_write_wifi_wpa_eap_tls (void) /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap", NULL); @@ -9709,9 +9454,6 @@ test_write_wifi_wpa_eap_tls (void) /* Wireless security setting */ s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_802_1X_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_8021x)); g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, "Bill Smith", NULL); @@ -9748,18 +9490,12 @@ test_write_wifi_wpa_eap_tls (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wpa-eap-tls-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -9842,14 +9578,9 @@ test_write_wifi_wpa_eap_ttls_tls (void) const char *ssid_data = "blahblah"; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -9863,9 +9594,6 @@ test_write_wifi_wpa_eap_ttls_tls (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (strlen (ssid_data)); @@ -9881,9 +9609,6 @@ test_write_wifi_wpa_eap_ttls_tls (void) /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap", NULL); @@ -9893,9 +9618,6 @@ test_write_wifi_wpa_eap_ttls_tls (void) /* Wireless security setting */ s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_802_1X_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_8021x)); nm_setting_802_1x_add_eap_method (s_8021x, "ttls"); @@ -9950,18 +9672,12 @@ test_write_wifi_wpa_eap_ttls_tls (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wpa-eap-ttls-tls-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -10044,14 +9760,9 @@ test_write_wifi_wpa_eap_ttls_mschapv2 (void) const char *ssid_data = "blahblah"; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -10065,9 +9776,6 @@ test_write_wifi_wpa_eap_ttls_mschapv2 (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (strlen (ssid_data)); @@ -10083,9 +9791,6 @@ test_write_wifi_wpa_eap_ttls_mschapv2 (void) /* Wireless security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap", NULL); @@ -10098,9 +9803,6 @@ test_write_wifi_wpa_eap_ttls_mschapv2 (void) /* Wireless security setting */ s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); - ASSERT (s_8021x != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_802_1X_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_8021x)); nm_setting_802_1x_add_eap_method (s_8021x, "ttls"); @@ -10124,18 +9826,12 @@ test_write_wifi_wpa_eap_ttls_mschapv2 (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wifi-wpa-eap-ttls-mschapv2-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -11148,14 +10844,9 @@ test_write_wired_qeth_dhcp (void) gboolean ignore_error = FALSE; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wired-qeth-dhcp-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-qeth-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -11169,9 +10860,6 @@ test_write_wired_qeth_dhcp (void) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - "wired-qeth-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); subchans = g_ptr_array_sized_new (3); @@ -11191,9 +10879,6 @@ test_write_wired_qeth_dhcp (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-qeth-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -11202,9 +10887,6 @@ test_write_wired_qeth_dhcp (void) /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-qeth-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -11415,14 +11097,9 @@ test_write_permissions (void) gboolean ignore_error = FALSE; connection = nm_connection_new (); - ASSERT (connection != NULL, - "permissions-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "permissions-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -11440,16 +11117,10 @@ test_write_permissions (void) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - "permissions-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "permissions-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -11458,9 +11129,6 @@ test_write_permissions (void) /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-qeth-dhcp-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -11669,14 +11337,9 @@ test_write_wired_pppoe (void) char *testfile = NULL; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wired-pppoe-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wired-pppoe-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -11690,16 +11353,10 @@ test_write_wired_pppoe (void) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - "wired-pppoe-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wired-pppoe-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -11708,9 +11365,6 @@ test_write_wired_pppoe (void) /* PPPoE setting */ s_pppoe = (NMSettingPPPOE *) nm_setting_pppoe_new (); - ASSERT (s_pppoe != NULL, - "wired-pppoe-write", "failed to allocate new %s setting", - NM_SETTING_PPPOE_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_pppoe)); g_object_set (G_OBJECT (s_pppoe), @@ -11721,9 +11375,6 @@ test_write_wired_pppoe (void) /* PPP setting */ s_ppp = (NMSettingPPP *) nm_setting_ppp_new (); - ASSERT (s_ppp != NULL, - "wired-pppoe-write", "failed to allocate new %s setting", - NM_SETTING_PPP_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ppp)); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -11754,14 +11405,9 @@ test_write_vpn (void) char *testfile = NULL; connection = nm_connection_new (); - ASSERT (connection != NULL, - "vpn-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "vpn-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -11775,9 +11421,6 @@ test_write_vpn (void) /* VPN setting */ s_vpn = (NMSettingVPN *) nm_setting_vpn_new (); - ASSERT (s_vpn != NULL, - "vpn-write", "failed to allocate new %s setting", - NM_SETTING_VPN_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_vpn)); g_object_set (s_vpn, @@ -11790,9 +11433,6 @@ test_write_vpn (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "vpn-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -11830,14 +11470,9 @@ test_write_mobile_broadband (gboolean gsm) char *testfile = NULL; connection = nm_connection_new (); - ASSERT (connection != NULL, - "mobile-broadband-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -11852,18 +11487,12 @@ test_write_mobile_broadband (gboolean gsm) if (gsm) { /* GSM setting */ s_gsm = (NMSettingGsm *) nm_setting_gsm_new (); - ASSERT (s_gsm != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_GSM_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_gsm)); g_object_set (s_gsm, NM_SETTING_GSM_NUMBER, "*99#", NULL); } else { /* CDMA setting */ s_cdma = (NMSettingCdma *) nm_setting_cdma_new (); - ASSERT (s_cdma != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_CDMA_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_cdma)); g_object_set (s_cdma, NM_SETTING_CDMA_NUMBER, "#777", NULL); @@ -11871,9 +11500,6 @@ test_write_mobile_broadband (gboolean gsm) /* Serial setting */ s_serial = (NMSettingSerial *) nm_setting_serial_new (); - ASSERT (s_serial != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_SERIAL_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_serial)); g_object_set (s_serial, @@ -11885,9 +11511,6 @@ test_write_mobile_broadband (gboolean gsm) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -11896,9 +11519,6 @@ test_write_mobile_broadband (gboolean gsm) /* PPP setting */ s_ppp = (NMSettingPPP *) nm_setting_ppp_new (); - ASSERT (s_ppp != NULL, - "mobile-broadband-write", "failed to allocate new %s setting", - NM_SETTING_PPP_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ppp)); ASSERT (nm_connection_verify (connection, &error) == TRUE, @@ -12697,14 +12317,9 @@ test_write_bond_main (void) gboolean ignore_error = FALSE; connection = nm_connection_new (); - ASSERT (connection != NULL, - "bond-main-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "bond-main-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -12718,16 +12333,10 @@ test_write_bond_main (void) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - "bond-main-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* bond setting */ s_bond = (NMSettingBond *) nm_setting_bond_new (); - ASSERT (s_bond != NULL, - "bond-main-write", "failed to allocate new %s setting", - NM_SETTING_BOND_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_bond)); g_object_set (s_bond, @@ -12736,9 +12345,6 @@ test_write_bond_main (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "bond-main-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -12755,9 +12361,6 @@ test_write_bond_main (void) /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "bond-main-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -12882,14 +12485,9 @@ test_write_bond_slave (void) gboolean ignore_error = FALSE; connection = nm_connection_new (); - ASSERT (connection != NULL, - "bond-slave-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "bond-slave-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -12905,9 +12503,6 @@ test_write_bond_slave (void) /* Wired setting */ s_wired = (NMSettingWired *) nm_setting_wired_new (); - ASSERT (s_wired != NULL, - "bond-main-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); mac = g_byte_array_sized_new (sizeof (tmpmac)); @@ -13078,14 +12673,9 @@ test_write_infiniband (void) gboolean ignore_error = FALSE; connection = nm_connection_new (); - ASSERT (connection != NULL, - "infiniband-write", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "infiniband-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -13099,9 +12689,6 @@ test_write_infiniband (void) /* InfiniBand setting */ s_infiniband = (NMSettingInfiniband *) nm_setting_infiniband_new (); - ASSERT (s_infiniband != NULL, - "infiniband-write", "failed to allocate new %s setting", - NM_SETTING_INFINIBAND_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_infiniband)); mac = g_byte_array_sized_new (sizeof (tmpmac)); @@ -13116,9 +12703,6 @@ test_write_infiniband (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "infiniband-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -13135,9 +12719,6 @@ test_write_infiniband (void) /* IP6 setting */ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - ASSERT (s_ip6 != NULL, - "wired-static-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -13264,14 +12845,9 @@ test_write_bond_slave_ib (void) gboolean ignore_error = FALSE; connection = nm_connection_new (); - ASSERT (connection != NULL, - "bond-slave-write-ib", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "bond-slave-write-ib", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -13287,9 +12863,6 @@ test_write_bond_slave_ib (void) /* InfiniBand setting */ s_infiniband = (NMSettingInfiniband *) nm_setting_infiniband_new (); - ASSERT (s_infiniband != NULL, - "bond-main-write", "failed to allocate new %s setting", - NM_SETTING_INFINIBAND_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_infiniband)); mac = g_byte_array_sized_new (sizeof (tmpmac)); diff --git a/src/settings/plugins/ifnet/connection_parser.c b/src/settings/plugins/ifnet/connection_parser.c index c85b5c4b5..d3e39351f 100644 --- a/src/settings/plugins/ifnet/connection_parser.c +++ b/src/settings/plugins/ifnet/connection_parser.c @@ -782,11 +782,6 @@ make_ip6_setting (NMConnection *connection, gboolean never_default = !has_default_ip6_route (conn_name); s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new (); - if (!s_ip6) { - g_set_error (error, ifnet_plugin_error_quark (), 0, - "Could not allocate IP6 setting"); - return; - } value = ifnet_get_data (conn_name, "enable_ipv6"); if (value && is_true (value)) @@ -1671,8 +1666,6 @@ ifnet_update_connection_from_config_block (const char *conn_name, gboolean success = FALSE; connection = nm_connection_new (); - if (!connection) - return NULL; setting = nm_connection_get_setting_connection (connection); if (!setting) { setting = NM_SETTING_CONNECTION (nm_setting_connection_new ()); diff --git a/src/settings/plugins/ifnet/nm-ifnet-connection.c b/src/settings/plugins/ifnet/nm-ifnet-connection.c index 873a62ecd..9042ddf8b 100644 --- a/src/settings/plugins/ifnet/nm-ifnet-connection.c +++ b/src/settings/plugins/ifnet/nm-ifnet-connection.c @@ -76,11 +76,6 @@ nm_ifnet_connection_new (const char *conn_name, NMConnection *source) } object = (GObject *) g_object_new (NM_TYPE_IFNET_CONNECTION, NULL); - if (!object) { - g_object_unref (tmp); - return NULL; - } - NM_IFNET_CONNECTION_GET_PRIVATE (object)->conn_name = g_strdup (conn_name); nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object), tmp, NULL); g_object_unref (tmp); diff --git a/src/settings/plugins/ifnet/plugin.c b/src/settings/plugins/ifnet/plugin.c index 5100ad3e4..81a4dbcdd 100644 --- a/src/settings/plugins/ifnet/plugin.c +++ b/src/settings/plugins/ifnet/plugin.c @@ -590,10 +590,8 @@ nm_system_config_factory (const char *config_file) if (!singleton) { singleton = SC_PLUGIN_IFNET (g_object_new (SC_TYPE_PLUGIN_IFNET, NULL)); - if (singleton) { - priv = SC_PLUGIN_IFNET_GET_PRIVATE (singleton); - priv->conf_file = strdup (config_file); - } + priv = SC_PLUGIN_IFNET_GET_PRIVATE (singleton); + priv->conf_file = strdup (config_file); } else g_object_ref (singleton); diff --git a/src/settings/plugins/ifupdown/plugin.c b/src/settings/plugins/ifupdown/plugin.c index 4dbb0aa28..4979c7649 100644 --- a/src/settings/plugins/ifupdown/plugin.c +++ b/src/settings/plugins/ifupdown/plugin.c @@ -712,10 +712,8 @@ nm_system_config_factory (const char *config_file) if (!singleton) { singleton = SC_PLUGIN_IFUPDOWN (g_object_new (SC_TYPE_PLUGIN_IFUPDOWN, NULL)); - if (singleton) { - priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (singleton); - priv->conf_file = strdup (config_file); - } + priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (singleton); + priv->conf_file = strdup (config_file); } else g_object_ref (singleton); diff --git a/src/settings/plugins/keyfile/nm-keyfile-connection.c b/src/settings/plugins/keyfile/nm-keyfile-connection.c index 6d72bbfe5..c128e1ac5 100644 --- a/src/settings/plugins/keyfile/nm-keyfile-connection.c +++ b/src/settings/plugins/keyfile/nm-keyfile-connection.c @@ -62,8 +62,6 @@ nm_keyfile_connection_new (const char *full_path, } object = (GObject *) g_object_new (NM_TYPE_KEYFILE_CONNECTION, NULL); - if (!object) - goto out; priv = NM_KEYFILE_CONNECTION_GET_PRIVATE (object); priv->path = g_strdup (full_path); diff --git a/src/settings/plugins/keyfile/plugin.c b/src/settings/plugins/keyfile/plugin.c index 062eb0822..e7e350b56 100644 --- a/src/settings/plugins/keyfile/plugin.c +++ b/src/settings/plugins/keyfile/plugin.c @@ -656,14 +656,12 @@ nm_settings_keyfile_plugin_new (const char *config_file) if (!singleton) { singleton = SC_PLUGIN_KEYFILE (g_object_new (SC_TYPE_PLUGIN_KEYFILE, NULL)); - if (singleton) { - priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (singleton); + priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (singleton); - priv->conf_file = g_strdup (config_file); + priv->conf_file = g_strdup (config_file); - /* plugin_set_hostname() has to be called *after* priv->conf_file is set */ - priv->hostname = plugin_get_hostname (singleton); - } + /* plugin_set_hostname() has to be called *after* priv->conf_file is set */ + priv->hostname = plugin_get_hostname (singleton); } else g_object_ref (singleton); diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/settings/plugins/keyfile/tests/test-keyfile.c index f14e5cf71..0e005f357 100644 --- a/src/settings/plugins/keyfile/tests/test-keyfile.c +++ b/src/settings/plugins/keyfile/tests/test-keyfile.c @@ -506,15 +506,10 @@ test_write_wired_connection (void) guint64 timestamp = 0x12345678L; connection = nm_connection_new (); - ASSERT (connection != NULL, - "connection-write", "failed to allocate new connection"); /* Connection setting */ s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); - ASSERT (s_con != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -530,9 +525,6 @@ test_write_wired_connection (void) /* Wired setting */ s_wired = NM_SETTING_WIRED (nm_setting_wired_new ()); - ASSERT (s_wired != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); mac = g_byte_array_sized_new (ETH_ALEN); @@ -546,9 +538,6 @@ test_write_wired_connection (void) /* IP4 setting */ s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); - ASSERT (s_ip4 != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -572,9 +561,6 @@ test_write_wired_connection (void) /* IP6 setting */ s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ()); - ASSERT (s_ip6 != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -754,15 +740,10 @@ test_write_ip6_wired_connection (void) const char *gw = "dcba::beef"; connection = nm_connection_new (); - ASSERT (connection != NULL, - "connection-write", "failed to allocate new connection"); /* Connection setting */ s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); - ASSERT (s_con != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -777,17 +758,11 @@ test_write_ip6_wired_connection (void) /* Wired setting */ s_wired = NM_SETTING_WIRED (nm_setting_wired_new ()); - ASSERT (s_wired != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_WIRED_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wired)); /* IP4 setting */ s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); - ASSERT (s_ip4 != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -797,9 +772,6 @@ test_write_ip6_wired_connection (void) /* IP6 setting */ s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ()); - ASSERT (s_ip6 != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -1066,15 +1038,10 @@ test_write_wireless_connection (void) guint64 timestamp = 0x12344433L; connection = nm_connection_new (); - ASSERT (connection != NULL, - "connection-write", "failed to allocate new connection"); /* Connection setting */ s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); - ASSERT (s_con != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -1090,9 +1057,6 @@ test_write_wireless_connection (void) /* Wireless setting */ s_wireless = NM_SETTING_WIRELESS (nm_setting_wireless_new ()); - ASSERT (s_wireless != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wireless)); bssid = g_byte_array_sized_new (ETH_ALEN); @@ -1113,9 +1077,6 @@ test_write_wireless_connection (void) /* IP4 setting */ s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); - ASSERT (s_ip4 != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -1125,9 +1086,6 @@ test_write_wireless_connection (void) /* IP6 setting */ s_ip6 = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ()); - ASSERT (s_ip6 != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_IP6_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip6)); g_object_set (s_ip6, @@ -1220,15 +1178,10 @@ test_write_string_ssid (void) GKeyFile *keyfile; connection = nm_connection_new (); - ASSERT (connection != NULL, - "connection-write", "failed to allocate new connection"); /* Connection setting */ s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); - ASSERT (s_con != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -1242,9 +1195,6 @@ test_write_string_ssid (void) /* Wireless setting */ s_wireless = NM_SETTING_WIRELESS (nm_setting_wireless_new ()); - ASSERT (s_wireless != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wireless)); ssid = g_byte_array_sized_new (sizeof (tmpssid)); @@ -1255,9 +1205,6 @@ test_write_string_ssid (void) /* IP4 setting */ s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); - ASSERT (s_ip4 != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -1846,15 +1793,10 @@ test_write_bt_dun_connection (void) guint64 timestamp = 0x12344433L; connection = nm_connection_new (); - ASSERT (connection != NULL, - "connection-write", "failed to allocate new connection"); /* Connection setting */ s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); - ASSERT (s_con != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -1870,9 +1812,6 @@ test_write_bt_dun_connection (void) /* Bluetooth setting */ s_bt = NM_SETTING_BLUETOOTH (nm_setting_bluetooth_new ()); - ASSERT (s_bt != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_BLUETOOTH_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_bt)); bdaddr = g_byte_array_sized_new (ETH_ALEN); @@ -1888,9 +1827,6 @@ test_write_bt_dun_connection (void) /* IP4 setting */ s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); - ASSERT (s_ip4 != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -1899,9 +1835,6 @@ test_write_bt_dun_connection (void) /* GSM setting */ s_gsm = NM_SETTING_GSM (nm_setting_gsm_new ()); - ASSERT (s_gsm != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_GSM_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_gsm)); g_object_set (s_gsm, @@ -2106,15 +2039,10 @@ test_write_gsm_connection (void) guint64 timestamp = 0x12344433L; connection = nm_connection_new (); - ASSERT (connection != NULL, - "connection-write", "failed to allocate new connection"); /* Connection setting */ s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ()); - ASSERT (s_con != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -2130,9 +2058,6 @@ test_write_gsm_connection (void) /* IP4 setting */ s_ip4 = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); - ASSERT (s_ip4 != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, @@ -2141,9 +2066,6 @@ test_write_gsm_connection (void) /* GSM setting */ s_gsm = NM_SETTING_GSM (nm_setting_gsm_new ()); - ASSERT (s_gsm != NULL, - "connection-write", "failed to allocate new %s setting", - NM_SETTING_GSM_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_gsm)); g_object_set (s_gsm, diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c index 75450a0a1..3f7dc4461 100644 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ b/src/supplicant-manager/nm-supplicant-interface.c @@ -1493,24 +1493,22 @@ nm_supplicant_interface_new (NMSupplicantManager *smgr, g_return_val_if_fail (ifname != NULL, NULL); self = g_object_new (NM_TYPE_SUPPLICANT_INTERFACE, NULL); - if (self) { - priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); + priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); - priv->smgr = g_object_ref (smgr); - id = g_signal_connect (priv->smgr, - "notify::" NM_SUPPLICANT_MANAGER_AVAILABLE, - G_CALLBACK (smgr_avail_cb), - self); - priv->smgr_avail_id = id; + priv->smgr = g_object_ref (smgr); + id = g_signal_connect (priv->smgr, + "notify::" NM_SUPPLICANT_MANAGER_AVAILABLE, + G_CALLBACK (smgr_avail_cb), + self); + priv->smgr_avail_id = id; - priv->dev = g_strdup (ifname); - priv->is_wireless = is_wireless; - priv->fast_supported = fast_supported; - priv->ap_support = ap_support; + priv->dev = g_strdup (ifname); + priv->is_wireless = is_wireless; + priv->fast_supported = fast_supported; + priv->ap_support = ap_support; - if (start_now) - interface_add (self, priv->is_wireless); - } + if (start_now) + interface_add (self, priv->is_wireless); return self; } diff --git a/src/supplicant-manager/tests/test-supplicant-config.c b/src/supplicant-manager/tests/test-supplicant-config.c index d92fb0d17..5c6795cc8 100644 --- a/src/supplicant-manager/tests/test-supplicant-config.c +++ b/src/supplicant-manager/tests/test-supplicant-config.c @@ -128,14 +128,9 @@ test_wifi_open (void) const char *bssid_str = "11:22:33:44:55:66"; connection = nm_connection_new (); - ASSERT (connection != NULL, - "wifi-open", "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - "wifi-open", "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -149,9 +144,6 @@ test_wifi_open (void) /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - "wifi-open", "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -171,9 +163,6 @@ test_wifi_open (void) /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - "wifi-open", "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); @@ -183,8 +172,6 @@ test_wifi_open (void) (error && error->message) ? error->message : "(unknown)"); config = nm_supplicant_config_new (); - ASSERT (config != NULL, - "wifi-open", "failed to create new supplicant config"); success = nm_supplicant_config_add_setting_wireless (config, s_wifi, TRUE, 0, TRUE); ASSERT (success == TRUE, @@ -230,14 +217,9 @@ test_wifi_wep_key (const char *detail, const char *bssid_str = "11:22:33:44:55:66"; connection = nm_connection_new (); - ASSERT (connection != NULL, - detail, "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -251,9 +233,6 @@ test_wifi_wep_key (const char *detail, /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -274,9 +253,6 @@ test_wifi_wep_key (const char *detail, /* Wifi Security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, @@ -287,9 +263,6 @@ test_wifi_wep_key (const char *detail, /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); @@ -299,8 +272,6 @@ test_wifi_wep_key (const char *detail, (error && error->message) ? error->message : "(unknown)"); config = nm_supplicant_config_new (); - ASSERT (config != NULL, - detail, "failed to create new supplicant config"); success = nm_supplicant_config_add_setting_wireless (config, s_wifi, TRUE, 0, TRUE); ASSERT (success == TRUE, @@ -374,14 +345,9 @@ test_wifi_wpa_psk (const char *detail, const char *bssid_str = "11:22:33:44:55:66"; connection = nm_connection_new (); - ASSERT (connection != NULL, - detail, "failed to allocate new connection"); /* Connection setting */ s_con = (NMSettingConnection *) nm_setting_connection_new (); - ASSERT (s_con != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_CONNECTION_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_con)); uuid = nm_utils_uuid_generate (); @@ -395,9 +361,6 @@ test_wifi_wpa_psk (const char *detail, /* Wifi setting */ s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); - ASSERT (s_wifi != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ssid = g_byte_array_sized_new (sizeof (ssid_data)); @@ -418,9 +381,6 @@ test_wifi_wpa_psk (const char *detail, /* Wifi Security setting */ s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); - ASSERT (s_wsec != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_WIRELESS_SECURITY_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); g_object_set (s_wsec, @@ -437,9 +397,6 @@ test_wifi_wpa_psk (const char *detail, /* IP4 setting */ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new (); - ASSERT (s_ip4 != NULL, - detail, "failed to allocate new %s setting", - NM_SETTING_IP4_CONFIG_SETTING_NAME); nm_connection_add_setting (connection, NM_SETTING (s_ip4)); g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL); @@ -449,8 +406,6 @@ test_wifi_wpa_psk (const char *detail, (error && error->message) ? error->message : "(unknown)"); config = nm_supplicant_config_new (); - ASSERT (config != NULL, - detail, "failed to create new supplicant config"); success = nm_supplicant_config_add_setting_wireless (config, s_wifi, TRUE, 0, TRUE); ASSERT (success == TRUE, diff --git a/src/vpn-manager/nm-vpn-service.c b/src/vpn-manager/nm-vpn-service.c index 668cbf2e3..d4980cee3 100644 --- a/src/vpn-manager/nm-vpn-service.c +++ b/src/vpn-manager/nm-vpn-service.c @@ -91,11 +91,6 @@ nm_vpn_service_new (const char *namefile, GError **error) } self = (NMVPNService *) g_object_new (NM_TYPE_VPN_SERVICE, NULL); - if (!self) { - g_set_error (error, 0, 0, "out of memory creating VPN service object"); - goto out; - } - NM_VPN_SERVICE_GET_PRIVATE (self)->name = g_strdup (name); NM_VPN_SERVICE_GET_PRIVATE (self)->dbus_service = g_strdup (dbus_service); NM_VPN_SERVICE_GET_PRIVATE (self)->program = g_strdup (program); diff --git a/src/wimax/nm-wimax-factory.c b/src/wimax/nm-wimax-factory.c index 95cb4bf74..0326088a6 100644 --- a/src/wimax/nm-wimax-factory.c +++ b/src/wimax/nm-wimax-factory.c @@ -30,18 +30,13 @@ nm_device_factory_create_device (GUdevDevice *device, const char *driver, GError **error) { - GObject *dev; - /* FIXME: check 'DEVTYPE' instead; but since we only support Intel * WiMAX devices for now this is appropriate. */ if (g_strcmp0 (driver, "i2400m_usb") != 0) return NULL; /* unsupported */ - dev = (GObject *) nm_device_wimax_new (devpath, ifname, driver); - if (dev == NULL) - g_set_error_literal (error, 0, 0, "Failed to create WiMAX device."); - return dev; + return (GObject *) nm_device_wimax_new (devpath, ifname, driver); } G_MODULE_EXPORT guint32