diff options
author | Matias De lellis <[email protected]> | 2014-12-14 13:44:34 -0300 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-15 15:01:56 +0100 |
commit | 9ae0be5ccf7df2f35c13653da97771b06cf6603f (patch) | |
tree | 5d9c87a4c225a067a887d90f001d163dc7d934a8 /src | |
parent | cdd64eb85839577b63a5dc8840cdb339d5b78abd (diff) | |
download | mate-system-monitor-9ae0be5ccf7df2f35c13653da97771b06cf6603f.tar.bz2 mate-system-monitor-9ae0be5ccf7df2f35c13653da97771b06cf6603f.tar.xz |
Fix a few of mem leaks. [Backported from old gnome-system-monitor]
Diffstat (limited to 'src')
-rw-r--r-- | src/procman.cpp | 4 | ||||
-rw-r--r-- | src/util.cpp | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/procman.cpp b/src/procman.cpp index c21e61f..180b0d4 100644 --- a/src/procman.cpp +++ b/src/procman.cpp @@ -189,7 +189,7 @@ static void color_changed_cb (GSettings *settings, const gchar *key, gpointer data) { ProcData * const procdata = static_cast<ProcData*>(data); - const gchar *color = g_settings_get_string (settings, key); + gchar *color = g_settings_get_string (settings, key); if (g_str_has_prefix (key, "cpu-color")) { for (int i = 0; i < procdata->config.num_cpus; i++) { @@ -220,6 +220,7 @@ color_changed_cb (GSettings *settings, const gchar *key, gpointer data) else { g_assert_not_reached(); } + g_free (color); } @@ -450,6 +451,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/util.cpp b/src/util.cpp index 28def73..a96f776 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -495,13 +495,19 @@ namespace procman std::string format_network(guint64 rate, guint64 max_rate) { - return procman::format_size(rate, max_rate, ProcData::get_instance()->config.network_in_bits); + char* bytes = procman::format_size(rate, max_rate, ProcData::get_instance()->config.network_in_bits); + std::string formatted(bytes); + g_free(bytes); + return formatted; } std::string format_network_rate(guint64 rate, guint64 max_rate) { - return procman::format_rate(rate, max_rate, ProcData::get_instance()->config.network_in_bits); + char* bytes = procman::format_size(rate, max_rate, ProcData::get_instance()->config.network_in_bits); + std::string formatted(bytes); + g_free(bytes); + return formatted; } } |