[gnome-control-center] network: Fix memory leaks using g_find_program_in_path
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Fix memory leaks using g_find_program_in_path
- Date: Wed, 18 Dec 2019 00:37:02 +0000 (UTC)
commit 4c6208dc66134adf12b8af022ae7134b376ace30
Author: Robert Ancell <robert ancell canonical com>
Date: Mon Dec 16 15:09:24 2019 +1300
network: Fix memory leaks using g_find_program_in_path
Added in d61d13d
panels/network/net-device-bluetooth.c | 10 ++++++++--
panels/network/net-device-mobile.c | 5 ++++-
2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/panels/network/net-device-bluetooth.c b/panels/network/net-device-bluetooth.c
index 6a0fa11d9..74dfb0e9a 100644
--- a/panels/network/net-device-bluetooth.c
+++ b/panels/network/net-device-bluetooth.c
@@ -80,6 +80,7 @@ static void
nm_device_bluetooth_refresh_ui (NetDeviceBluetooth *self)
{
NMDeviceState state;
+ g_autofree gchar *path = NULL;
/* set up the device on/off switch */
state = nm_device_get_state (self->device);
@@ -89,7 +90,8 @@ nm_device_bluetooth_refresh_ui (NetDeviceBluetooth *self)
update_off_switch_from_device_state (self->device_off_switch, state, self);
/* set up the Options button */
- gtk_widget_set_visible (GTK_WIDGET (self->options_button), state != NM_DEVICE_STATE_UNMANAGED &&
g_find_program_in_path ("nm-connection-editor") != NULL);
+ path = g_find_program_in_path ("nm-connection-editor");
+ gtk_widget_set_visible (GTK_WIDGET (self->options_button), state != NM_DEVICE_STATE_UNMANAGED &&
path != NULL);
}
static void
@@ -179,8 +181,12 @@ net_device_bluetooth_class_init (NetDeviceBluetoothClass *klass)
static void
net_device_bluetooth_init (NetDeviceBluetooth *self)
{
+ g_autofree gchar *path = NULL;
+
gtk_widget_init_template (GTK_WIDGET (self));
- gtk_widget_set_visible (GTK_WIDGET (self->options_button), g_find_program_in_path
("nm-connection-editor") != NULL);
+
+ path = g_find_program_in_path ("nm-connection-editor");
+ gtk_widget_set_visible (GTK_WIDGET (self->options_button), path != NULL);
}
NetDeviceBluetooth *
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index 1bc1fb8dc..1d9eba2f1 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -770,11 +770,14 @@ net_device_mobile_class_init (NetDeviceMobileClass *klass)
static void
net_device_mobile_init (NetDeviceMobile *self)
{
+ g_autofree gchar *path = NULL;
+
gtk_widget_init_template (GTK_WIDGET (self));
self->cancellable = g_cancellable_new ();
- gtk_widget_set_visible (GTK_WIDGET (self->options_button), g_find_program_in_path
("nm-connection-editor") != NULL);
+ path = g_find_program_in_path ("nm-connection-editor");
+ gtk_widget_set_visible (GTK_WIDGET (self->options_button), path != NULL);
}
NetDeviceMobile *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]