[gnome-control-center/gnome-3-24] network: Avoid crashing if the NMDevice doesn't have a hw-address
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-24] network: Avoid crashing if the NMDevice doesn't have a hw-address
- Date: Fri, 16 Jun 2017 17:48:23 +0000 (UTC)
commit e78792f873a2b053188b77c7378ee0e0d3a95a55
Author: Rui Matos <tiagomatos gmail com>
Date: Fri Jun 16 12:24:05 2017 +0200
network: Avoid crashing if the NMDevice doesn't have a hw-address
The property might not exist and we would g_free() an uninitialized
pointer. Using the proper API avoids all that.
https://bugzilla.gnome.org/show_bug.cgi?id=783839
panels/network/net-device-simple.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/panels/network/net-device-simple.c b/panels/network/net-device-simple.c
index 3a3c2c9..79b6ca3 100644
--- a/panels/network/net-device-simple.c
+++ b/panels/network/net-device-simple.c
@@ -85,7 +85,7 @@ static void
nm_device_simple_refresh_ui (NetDeviceSimple *device_simple)
{
NetDeviceSimplePrivate *priv = device_simple->priv;
- char *hwaddr;
+ const char *hwaddr;
GtkWidget *widget;
char *speed = NULL;
NMDevice *nm_device;
@@ -119,11 +119,8 @@ nm_device_simple_refresh_ui (NetDeviceSimple *device_simple)
panel_set_device_status (priv->builder, "label_status", nm_device, speed);
/* device MAC */
- g_object_get (G_OBJECT (nm_device),
- "hw-address", &hwaddr,
- NULL);
+ hwaddr = nm_device_get_hw_address (nm_device);
panel_set_device_widget_details (priv->builder, "mac", hwaddr);
- g_free (hwaddr);
/* set IP entries */
panel_set_device_widgets (priv->builder, nm_device);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]