[network-manager-applet/bg/unsupported-properties-bgo777225: 1/4] editor: don't leak the cloned MAC string
- From: Beniamino Galvani <bgalvani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/bg/unsupported-properties-bgo777225: 1/4] editor: don't leak the cloned MAC string
- Date: Tue, 24 Jan 2017 09:26:27 +0000 (UTC)
commit eca461a2141c0e0942ab0e74e5922a329fe113a4
Author: Beniamino Galvani <bgalvani redhat com>
Date: Tue Jan 24 10:09:34 2017 +0100
editor: don't leak the cloned MAC string
Fixes: 85b6b659a140a59c3df787062e089a0b4e2a547d
src/connection-editor/ce-page.c | 9 ++++++---
src/connection-editor/ce-page.h | 2 +-
src/connection-editor/page-ethernet.c | 3 ++-
src/connection-editor/page-vlan.c | 3 ++-
src/connection-editor/page-wifi.c | 3 ++-
5 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index f88dce0..5ba6ca9 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -319,14 +319,14 @@ ce_page_setup_cloned_mac_combo (GtkComboBoxText *combo, const char *current)
}
}
-const char *
+char *
ce_page_cloned_mac_get (GtkComboBoxText *combo)
{
const char *id;
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (combo));
if (id)
- return id;
+ return g_strdup (id);
return gtk_combo_box_text_get_active_text (combo);
}
@@ -358,10 +358,13 @@ mac_valid (const char *mac, int type, const char *property_name, GError **error)
gboolean
ce_page_cloned_mac_combo_valid (GtkComboBoxText *combo, int type, const char *property_name, GError **error)
{
+ gs_free char *text = NULL;
+
if (gtk_combo_box_get_active (GTK_COMBO_BOX (combo)) != -1)
return TRUE;
- return mac_valid (gtk_combo_box_text_get_active_text (combo),
+ text = gtk_combo_box_text_get_active_text (combo);
+ return mac_valid (text,
type,
property_name,
error);
diff --git a/src/connection-editor/ce-page.h b/src/connection-editor/ce-page.h
index e869bb6..5cd1c3d 100644
--- a/src/connection-editor/ce-page.h
+++ b/src/connection-editor/ce-page.h
@@ -150,7 +150,7 @@ gboolean ce_page_device_entry_get (GtkEntry *entry, int type,
char **ifname, char **mac,
const char *device_name,
GError **error);
-const char *ce_page_cloned_mac_get (GtkComboBoxText *combo);
+char *ce_page_cloned_mac_get (GtkComboBoxText *combo);
gboolean ce_page_cloned_mac_combo_valid (GtkComboBoxText *combo, int type, const char *property_name, GError
**error);
void ce_page_changed (CEPage *self);
diff --git a/src/connection-editor/page-ethernet.c b/src/connection-editor/page-ethernet.c
index fbdafaa..f41b278 100644
--- a/src/connection-editor/page-ethernet.c
+++ b/src/connection-editor/page-ethernet.c
@@ -385,7 +385,7 @@ ui_to_setting (CEPageEthernet *self)
const char *duplex;
char *ifname = NULL;
char *device_mac = NULL;
- const char *cloned_mac;
+ char *cloned_mac;
GtkWidget *entry;
NMSettingWiredWakeOnLan wol = NM_SETTING_WIRED_WAKE_ON_LAN_NONE;
const char *wol_passwd = NULL;
@@ -500,6 +500,7 @@ ui_to_setting (CEPageEthernet *self)
g_free (ifname);
g_free (device_mac);
+ g_free (cloned_mac);
}
static gboolean
diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c
index 6806d8b..79c294c 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -618,7 +618,7 @@ ui_to_setting (CEPageVlan *self)
CEPageVlanPrivate *priv = CE_PAGE_VLAN_GET_PRIVATE (self);
NMConnection *connection = CE_PAGE (self)->connection;
NMSettingConnection *s_con = nm_connection_get_setting_connection (connection);
- const char *cloned_mac;
+ char *cloned_mac;
VlanParent *parent = NULL;
int active_id, parent_id, vid;
const char *parent_iface = NULL, *parent_uuid = NULL;
@@ -718,6 +718,7 @@ ui_to_setting (CEPageVlan *self)
}
g_free (tmp_parent_iface);
+ g_free (cloned_mac);
}
static gboolean
diff --git a/src/connection-editor/page-wifi.c b/src/connection-editor/page-wifi.c
index f97365d..fad89e7 100644
--- a/src/connection-editor/page-wifi.c
+++ b/src/connection-editor/page-wifi.c
@@ -485,7 +485,7 @@ ui_to_setting (CEPageWifi *self)
const char *bssid = NULL;
char *ifname = NULL;
char *device_mac = NULL;
- const char *cloned_mac;
+ char *cloned_mac;
const char *mode;
const char *band;
GtkWidget *entry;
@@ -548,6 +548,7 @@ ui_to_setting (CEPageWifi *self)
g_bytes_unref (ssid);
g_free (ifname);
g_free (device_mac);
+ g_free (cloned_mac);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]