Commit 7b359370 authored by Beniamino Galvani's avatar Beniamino Galvani

editor: don't leak the cloned MAC string

Fixes: 85b6b659
parent ecdb1fe1
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -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 = NULL;
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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment