diff options
author | Thomas Haller <thaller@redhat.com> | 2017-01-26 16:57:26 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-01-26 22:40:49 +0100 |
commit | fe9727632338315f256d350f36cd186f1072f3dc (patch) | |
tree | 38a8e5aa57af99eefd5d321b8c89189479c9f1b8 | |
parent | e0bdcd687064121db35c3cede932f1ab0f157fe9 (diff) | |
download | network-manager-applet-fe9727632338315f256d350f36cd186f1072f3dc.tar.gz |
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.
-rw-r--r-- | 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 e73c08f5..7e4ab739 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 */ |