From c5e5a6e7b50f7abcc7c0d91f0a40702f0a46ca5a Mon Sep 17 00:00:00 2001 From: monsta Date: Tue, 23 Jan 2018 16:23:02 +0300 Subject: udisks plugin: fix memory management for GValue variables fixes build warnings as well --- plugins/udisks/udisks-plugin.c | 18 +++++++++--------- 1 file 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" -- cgit v1.2.1