NetworkManager r4294 - in trunk: . system-settings/plugins/ifcfg-fedora



Author: dcbw
Date: Mon Nov 17 18:39:20 2008
New Revision: 4294
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4294&view=rev

Log:
2008-11-17  Dan Williams  <dcbw redhat com>

	* system-settings/plugins/ifcfg-fedora/reader.c
		- (read_mac_address): clean up
		- (make_wireless_setting): pass NULL array to read_mac_address() like it
			expects

	* system-settings/plugins/ifcfg-fedora/plugin.c
		- (read_one_connection): don't segfault on NULL errors



Modified:
   trunk/ChangeLog
   trunk/system-settings/plugins/ifcfg-fedora/plugin.c
   trunk/system-settings/plugins/ifcfg-fedora/reader.c

Modified: trunk/system-settings/plugins/ifcfg-fedora/plugin.c
==============================================================================
--- trunk/system-settings/plugins/ifcfg-fedora/plugin.c	(original)
+++ trunk/system-settings/plugins/ifcfg-fedora/plugin.c	Mon Nov 17 18:39:20 2008
@@ -199,7 +199,7 @@
 		                  G_CALLBACK (connection_ifcfg_changed), plugin);
 	} else {
 		PLUGIN_PRINT (IFCFG_PLUGIN_NAME, "    error: %s",
-		              error->message ? error->message : "(unknown)");
+		              (error && error->message) ? error->message : "(unknown)");
 		g_error_free (error);
 	}
 

Modified: trunk/system-settings/plugins/ifcfg-fedora/reader.c
==============================================================================
--- trunk/system-settings/plugins/ifcfg-fedora/reader.c	(original)
+++ trunk/system-settings/plugins/ifcfg-fedora/reader.c	Mon Nov 17 18:39:20 2008
@@ -386,24 +386,16 @@
 
 	mac = ether_aton (value);
 	if (!mac) {
+		g_free (value);
 		g_set_error (error, ifcfg_plugin_error_quark (), 0,
 		             "The MAC address '%s' was invalid.", value);
-		goto error;
+		return FALSE;
 	}
 
 	g_free (value);
 	*array = g_byte_array_sized_new (ETH_ALEN);
 	g_byte_array_append (*array, (guint8 *) mac->ether_addr_octet, ETH_ALEN);
-
 	return TRUE;
-
-error:
-	g_free (value);
-	if (*array) {
-		g_byte_array_free (*array, TRUE);
-		*array = NULL;
-	}
-	return FALSE;
 }
 
 static gboolean
@@ -647,7 +639,7 @@
                        GError **error)
 {
 	NMSettingWireless *s_wireless;
-	GByteArray *array;
+	GByteArray *array = NULL;
 	char *value;
 
 	s_wireless = NM_SETTING_WIRELESS (nm_setting_wireless_new ());



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]