[gnome-system-monitor] Fixed various memory leaks in prettytable, procman-app, sysinfo and util. https://bugzilla.gnome.org
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Fixed various memory leaks in prettytable, procman-app, sysinfo and util. https://bugzilla.gnome.org
- Date: Tue, 6 Nov 2012 21:42:48 +0000 (UTC)
commit c2c23596a3dbe0c2fbb29b9f0c3efaa53e62e0d4
Author: Pavel Vasin <rat4vier gmail com>
Date: Tue Nov 6 23:41:54 2012 +0200
Fixed various memory leaks in prettytable, procman-app, sysinfo and util.
https://bugzilla.gnome.org/show_bug.cgi?id=686812
src/prettytable.cpp | 1 +
src/procman-app.cpp | 9 ++++++++-
src/sysinfo.cpp | 5 ++++-
src/util.cpp | 5 ++++-
4 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/prettytable.cpp b/src/prettytable.cpp
index c201e4f..cb9c76a 100644
--- a/src/prettytable.cpp
+++ b/src/prettytable.cpp
@@ -206,6 +206,7 @@ PrettyTable::get_icon_from_gio(const ProcInfo &info)
icon = this->theme->load_gicon(gicon, APP_ICON_SIZE, Gtk::ICON_LOOKUP_USE_BUILTIN);
}
+ g_strfreev(cmdline);
return icon;
}
diff --git a/src/procman-app.cpp b/src/procman-app.cpp
index e08b903..5c160c5 100644
--- a/src/procman-app.cpp
+++ b/src/procman-app.cpp
@@ -161,6 +161,7 @@ apply_cpu_color_settings(GSettings *settings, gpointer data)
child = g_variant_get_child_value ( cpu_colors_var, i );
g_variant_get_child( child, 1, "s", &color);
g_variant_builder_add_value ( &builder, child);
+ g_variant_unref (child);
} else {
color = g_strdup ("#f25915e815e8");
g_variant_builder_add(&builder, "(us)", i, color);
@@ -172,7 +173,11 @@ apply_cpu_color_settings(GSettings *settings, gpointer data)
// if the user has more cores than colors stored in the gsettings, store the newly built gvariant in gsettings
if (n < static_cast<guint>(app->config.num_cpus)) {
g_settings_set_value(settings, "cpu-colors", full);
+ } else {
+ g_variant_unref(full);
}
+
+ g_variant_unref(cpu_colors_var);
}
static void
@@ -191,7 +196,7 @@ color_changed_cb (GSettings *settings, const gchar *key, gpointer data)
return;
}
- const gchar *color = g_settings_get_string (settings, key);
+ gchar *color = g_settings_get_string (settings, key);
if (g_str_equal (key, "mem-color")) {
gdk_rgba_parse (&app->config.mem_color, color);
app->mem_graph->colors.at(0) = app->config.mem_color;
@@ -211,6 +216,7 @@ color_changed_cb (GSettings *settings, const gchar *key, gpointer data)
else {
g_assert_not_reached();
}
+ g_free (color);
}
static void
@@ -436,6 +442,7 @@ procman_get_tree_state (GSettings *settings, GtkWidget *tree, const gchar *child
proctable_set_columns_order(GTK_TREE_VIEW(tree), order);
+ g_variant_unref(value);
g_slist_free(order);
}
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp
index 041569d..51e7b44 100644
--- a/src/sysinfo.cpp
+++ b/src/sysinfo.cpp
@@ -112,7 +112,10 @@ namespace {
/* translators: This is the type of architecture, for example:
* "64-bit" or "32-bit" */
- return string(g_strdup_printf (_("%d-bit"), bits));
+ char* bytes = g_strdup_printf (_("%d-bit"), bits);
+ string retval(bytes);
+ g_free(bytes);
+ return retval;
}
typedef struct
diff --git a/src/util.cpp b/src/util.cpp
index 8532e13..874ede4 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -604,7 +604,10 @@ namespace procman
std::string format_network(guint64 rate, guint64 max_rate)
{
- return procman::format_size(rate, max_rate, ProcmanApp::get()->config.network_in_bits);
+ char* bytes = procman::format_size(rate, max_rate, ProcmanApp::get()->config.network_in_bits);
+ std::string formatted(bytes);
+ g_free(bytes);
+ return formatted;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]