summaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorMatias De lellis <[email protected]>2014-12-14 13:44:34 -0300
committerinfirit <[email protected]>2014-12-15 15:01:56 +0100
commit9ae0be5ccf7df2f35c13653da97771b06cf6603f (patch)
tree5d9c87a4c225a067a887d90f001d163dc7d934a8 /src/util.cpp
parentcdd64eb85839577b63a5dc8840cdb339d5b78abd (diff)
downloadmate-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/util.cpp')
-rw-r--r--src/util.cpp10
1 files changed, 8 insertions, 2 deletions
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;
}
}