[network-manager-applet] c-e: refactor mac_addres handling in get_device_for_connection() in "page-master.c"
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] c-e: refactor mac_addres handling in get_device_for_connection() in "page-master.c"
- Date: Thu, 26 Jan 2017 21:41:55 +0000 (UTC)
commit fe9727632338315f256d350f36cd186f1072f3dc
Author: Thomas Haller <thaller redhat com>
Date: Thu Jan 26 16:57:26 2017 +0100
c-e: refactor mac_addres handling in get_device_for_connection() in "page-master.c"
Use gs_free attribute to free the mac_address. Also, treat an empty
mac_address string as NULL. Empty is invalid anyway and not expected.
src/connection-editor/page-master.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/src/connection-editor/page-master.c b/src/connection-editor/page-master.c
index e73c08f..7e4ab73 100644
--- a/src/connection-editor/page-master.c
+++ b/src/connection-editor/page-master.c
@@ -196,18 +196,15 @@ get_device_for_connection (NMClient *client, NMConnection *conn)
if ( !nm_setting_connection_get_interface_name (s_con)
&& !nm_connection_get_interface_name (conn)) {
NMSetting *s_hw;
- gchar *mac_address;
+ gs_free char *mac_address = NULL;
s_hw = nm_connection_get_setting_by_name (conn, nm_setting_connection_get_connection_type
(s_con));
if (!s_hw || !g_object_class_find_property (G_OBJECT_GET_CLASS (s_hw), "mac-address"))
return NULL;
g_object_get (G_OBJECT (s_hw), "mac-address", &mac_address, NULL);
- if (!mac_address || !mac_address[0]) {
- g_free (mac_address);
+ if (!mac_address)
return NULL;
- }
- g_free (mac_address);
}
/* OK, now find that device */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]