diff --git a/common/graph-parm.c b/common/graph-parm.c index 6cb9c4b..819fa34 100644 --- a/common/graph-parm.c +++ b/common/graph-parm.c @@ -85,6 +85,8 @@ multiload_graph_parm_get_data (int Maximum, int data[4], LoadGraph *g, Parametri } } + g_free (stdout); + g_free (stderr); if (xd->error == TRUE) { memset(xd->result, 0, 4*sizeof(xd->result[0])); diff --git a/common/load-graph.c b/common/load-graph.c index 3c32960..f647a20 100644 --- a/common/load-graph.c +++ b/common/load-graph.c @@ -93,6 +93,7 @@ load_graph_cairo_set_gradient(cairo_t *cr, double width, double height, int dire cairo_pattern_add_color_stop_rgb (pat, 0, a->red, a->green, a->blue); cairo_pattern_add_color_stop_rgb (pat, 1, b->red, b->green, b->blue); cairo_set_source(cr, pat); + cairo_pattern_destroy (pat); } /* Redraws the backing pixmap for the load graph and updates the window */ @@ -446,7 +447,7 @@ load_graph_new (MultiloadPlugin *ma, guint id) g_signal_connect (G_OBJECT(g->disp), "draw", G_CALLBACK (load_graph_draw_cb), g); #endif */ g_signal_connect (G_OBJECT(g->disp), "configure_event", G_CALLBACK (load_graph_configure), g); - g_signal_connect (G_OBJECT(g->disp), "destroy", G_CALLBACK (load_graph_destroy), g); + g_signal_connect (G_OBJECT(g->main_widget), "destroy", G_CALLBACK (load_graph_destroy), g); g_signal_connect (G_OBJECT(g->disp), "button-press-event", G_CALLBACK (load_graph_clicked), g); g_signal_connect (G_OBJECT(g->disp), "enter-notify-event", G_CALLBACK(load_graph_mouse_move_cb), g); g_signal_connect (G_OBJECT(g->disp), "leave-notify-event", G_CALLBACK(load_graph_mouse_move_cb), g); diff --git a/common/multiload.c b/common/multiload.c index 27ff1f2..5e90231 100644 --- a/common/multiload.c +++ b/common/multiload.c @@ -366,20 +366,22 @@ multiload_new() } void -multiload_destroy(MultiloadPlugin *ma) +multiload_free(MultiloadPlugin *ma) { gint i; for (i = 0; i < GRAPH_MAX; i++) { - load_graph_stop(ma->graphs[i]); - gtk_widget_destroy(ma->graphs[i]->main_widget); + load_graph_stop (ma->graphs[i]); + gtk_widget_destroy (ma->graphs[i]->main_widget); - load_graph_unalloc(ma->graphs[i]); - g_free(ma->graphs[i]); + load_graph_unalloc (ma->graphs[i]); + g_free (ma->graphs[i]); - g_free(ma->extra_data[i]); + g_free (ma->extra_data[i]); } + g_free (ma); + g_debug("[multiload] Destroyed"); } diff --git a/common/multiload.h b/common/multiload.h index 934c66b..07164e3 100644 --- a/common/multiload.h +++ b/common/multiload.h @@ -172,7 +172,7 @@ multiload_defaults(MultiloadPlugin *ma); G_GNUC_INTERNAL MultiloadPlugin* multiload_new(); G_GNUC_INTERNAL void -multiload_destroy(MultiloadPlugin *ma); +multiload_free(MultiloadPlugin *ma); G_GNUC_INTERNAL int multiload_find_graph_by_name(char *str, char **suffix); diff --git a/common/ps-settings-impl-gkeyfile.inc b/common/ps-settings-impl-gkeyfile.inc index ef22a4e..dab3836 100644 --- a/common/ps-settings-impl-gkeyfile.inc +++ b/common/ps-settings-impl-gkeyfile.inc @@ -60,6 +60,7 @@ multiload_ps_settings_open_for_read(MultiloadPlugin *ma) } } + g_free(fname); g_clear_error(&err); return gkf; } diff --git a/common/ui.c b/common/ui.c index 693ffc6..1fd8172 100644 --- a/common/ui.c +++ b/common/ui.c @@ -418,9 +418,12 @@ multiload_ui_parse_cmdline(int *argc, char ***argv, GOptionEntry *extra_entries) if (!g_option_context_parse (context, argc, argv, &error)) { g_print ("%s\n", error->message); + g_error_free (error); exit (1); } + g_option_context_free (context); + return options; } diff --git a/indicator/plugin.c b/indicator/plugin.c index ed8ac90..b97bde5 100644 --- a/indicator/plugin.c +++ b/indicator/plugin.c @@ -61,19 +61,19 @@ indicator_cleanup(int sig) sprintf(signame, "Signal %d", sig); printf("Received %s, cleaning up...\n", signame); - remove(icon_filename[0]); - remove(icon_filename[1]); - remove(icon_directory); + remove(icon_filename[0]); + remove(icon_filename[1]); + remove(icon_directory); - exit(0); + exit(0); } static void indicator_destroy_cb(GtkWidget *widget, MultiloadPlugin *ma) { - gtk_main_quit (); - g_free(ma); - indicator_cleanup(0); + gtk_main_quit (); + multiload_free (ma); + indicator_cleanup (0); } static void diff --git a/standalone/plugin.c b/standalone/plugin.c index 5910f97..5dd6b51 100644 --- a/standalone/plugin.c +++ b/standalone/plugin.c @@ -41,8 +41,8 @@ static void standalone_destroy_cb (GtkWidget *widget, MultiloadPlugin *multiload) { - gtk_main_quit (); - g_free(multiload); + gtk_main_quit (); + multiload_free (multiload); } static void diff --git a/systray/plugin.c b/systray/plugin.c index 8159a1e..208254a 100644 --- a/systray/plugin.c +++ b/systray/plugin.c @@ -48,8 +48,8 @@ static guint timer_indexes[GRAPH_MAX]; static void systray_destroy_cb(GtkWidget *widget, MultiloadPlugin *ma) { - gtk_main_quit (); - g_free(ma); + gtk_main_quit (); + multiload_free (ma); } static void diff --git a/xfce4/plugin.c b/xfce4/plugin.c index ee2ab2f..707e20d 100644 --- a/xfce4/plugin.c +++ b/xfce4/plugin.c @@ -141,7 +141,7 @@ xfce_free_cb (XfcePanelPlugin *plugin, MultiloadPlugin *multiload) if (G_UNLIKELY (multiload->pref_dialog != NULL)) gtk_widget_destroy (multiload->pref_dialog); - multiload_destroy (multiload); + multiload_free (multiload); gtk_widget_destroy (GTK_WIDGET(multiload->container)); g_slice_free (MultiloadPlugin, multiload);