[Xfce4-commits] [panel-plugins/xfce4-systemload-plugin] 02/02: Fix possible memory leak

noreply at xfce.org noreply at xfce.org
Sun Jun 23 03:36:55 CEST 2019


This is an automated email from the git hooks/post-receive script.

a   n   d   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-systemload-plugin.

commit ef8b279c575f5d33cf39ddf5c87489d306b9ca38
Author: Andre Miranda <andreldm at xfce.org>
Date:   Sat Jun 22 22:20:29 2019 -0300

    Fix possible memory leak
---
 panel-plugin/systemload.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/panel-plugin/systemload.c b/panel-plugin/systemload.c
index ee11297..af75be4 100644
--- a/panel-plugin/systemload.c
+++ b/panel-plugin/systemload.c
@@ -436,7 +436,7 @@ setup_monitor(t_global_monitor *global)
 {
     gint count;
 #if GTK_CHECK_VERSION (3, 16, 0)
-    gchar * css;
+    gchar *css, *color;
 #endif
 
     gtk_widget_hide(GTK_WIDGET(global->uptime->ebox));
@@ -449,15 +449,16 @@ setup_monitor(t_global_monitor *global)
                            global->monitor[count]->options.label_text);
 
 #if GTK_CHECK_VERSION (3, 16, 0)
+        color = gdk_rgba_to_string(&global->monitor[count]->options.color);
 #if GTK_CHECK_VERSION (3, 20, 0)
-        css = g_strdup_printf("progressbar progress { background-color: %s; background-image: none; }",
+        css = g_strdup_printf("progressbar progress { background-color: %s; background-image: none; }", color);
 #else
-        css = g_strdup_printf(".progressbar progress { background-color: %s; background-image: none; }",
+        css = g_strdup_printf(".progressbar progress { background-color: %s; background-image: none; }", color);
 #endif
-                              gdk_rgba_to_string(&global->monitor[count]->options.color));
         gtk_css_provider_load_from_data (
             g_object_get_data(G_OBJECT(global->monitor[count]->status), "css_provider"),
             css, strlen(css), NULL);
+        g_free(color);
         g_free(css);
 #else
         gtk_widget_override_background_color(GTK_WIDGET(global->monitor[count]->status),
@@ -575,7 +576,7 @@ monitor_write_config(XfcePanelPlugin *plugin, t_global_monitor *global)
 {
     gint count;
     XfceRc *rc;
-    char *file;
+    char *file, *color;
 
     if (!(file = xfce_panel_plugin_save_location (plugin, TRUE)))
         return;
@@ -601,7 +602,9 @@ monitor_write_config(XfcePanelPlugin *plugin, t_global_monitor *global)
         xfce_rc_write_bool_entry (rc, "Use_Label",
                 global->monitor[count]->options.use_label);
 
-        xfce_rc_write_entry (rc, "Color", gdk_rgba_to_string(&global->monitor[count]->options.color));
+        color = gdk_rgba_to_string (&global->monitor[count]->options.color);
+        xfce_rc_write_entry (rc, "Color", color);
+        g_free (color);
 
         xfce_rc_write_entry (rc, "Text",
             global->monitor[count]->options.label_text ?

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list