summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authormonsta <[email protected]>2018-01-23 16:23:02 +0300
committerraveit65 <[email protected]>2018-01-26 16:26:28 +0100
commitc5e5a6e7b50f7abcc7c0d91f0a40702f0a46ca5a (patch)
tree6176fcd8a413b74ecdb9da6f6a42d9416ceb2e0e /plugins
parent9a5fc1a315cd093563b493c35f521e0ec2621f4a (diff)
downloadmate-sensors-applet-c5e5a6e7b50f7abcc7c0d91f0a40702f0a46ca5a.tar.bz2
mate-sensors-applet-c5e5a6e7b50f7abcc7c0d91f0a40702f0a46ca5a.tar.xz
udisks plugin: fix memory management for GValue variables
fixes build warnings as well
Diffstat (limited to 'plugins')
-rw-r--r--plugins/udisks/udisks-plugin.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/udisks/udisks-plugin.c b/plugins/udisks/udisks-plugin.c
index be259a4..4f2bc7a 100644
--- a/plugins/udisks/udisks-plugin.c
+++ b/plugins/udisks/udisks-plugin.c
@@ -54,9 +54,9 @@ DBusGConnection *connection;
static void update_device(DevInfo *info)
{
DBusGProxy *sensor_proxy;
- GValue smart_time = { 0, };
+ GValue smart_time = G_VALUE_INIT;
SkDisk *sk_disk;
- GValue smart_blob_val = { 0, };
+ GValue smart_blob_val = G_VALUE_INIT;
GArray *smart_blob;
guint64 temperature;
@@ -227,11 +227,11 @@ static void udisks_plugin_get_sensors(GList **sensors) {
G_CALLBACK(udisks_changed_signal_cb),
path, NULL);
- gchar *model = g_value_get_string(&model_v);
- gchar *dev = g_value_get_string(&dev_v);
- GStrv ids = g_value_get_boxed(&ids_v);
+ const gchar *model = g_value_get_string(&model_v);
+ const gchar *dev = g_value_get_string(&dev_v);
+ const GStrv ids = g_value_get_boxed(&ids_v);
- gchar *id = ids != NULL && ids[0] != NULL ? ids[0] : dev;
+ const gchar *id = ids != NULL && ids[0] != NULL ? ids[0] : dev;
info = g_malloc0(sizeof(DevInfo));
if (devices == NULL)
@@ -257,9 +257,9 @@ static void udisks_plugin_get_sensors(GList **sensors) {
HDD_ICON,
DEFAULT_GRAPH_COLOR);
- g_strfreev(ids);
- g_free(model);
- g_free(dev);
+ g_value_unset(&ids_v);
+ g_value_unset(&model_v);
+ g_value_unset(&dev_v);
g_debug("Added %s %s", path, id);
} else {
g_debug ("Cannot obtain data for device: %s\n"