summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-09-03 12:29:01 -0400
committerPatrick Griffis <tingping@tingping.se>2016-09-03 12:29:01 -0400
commit737f87fa161e1393a8dd47aa61a782a37f22ca7d (patch)
treeff189b6c63f55f60b4a1ef55b801d6b5efafbce4
parent4658c5d4e544380280bade4c682551c1f0aee1bd (diff)
sysinfo: Fix leak
-rw-r--r--plugins/sysinfo/unix/backend.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/sysinfo/unix/backend.c b/plugins/sysinfo/unix/backend.c
index 9d886f09..b6876452 100644
--- a/plugins/sysinfo/unix/backend.c
+++ b/plugins/sysinfo/unix/backend.c
@@ -60,14 +60,14 @@ char *sysinfo_backend_get_memory(void)
 	{
 		return NULL;
 	}
-	if (xs_parse_meminfo (&swap_total, &swap_free, 1) != 1)
+	if (xs_parse_meminfo (&swap_total, &swap_free, 1) != 1 && swap_total != 0)
 	{
 		swap_fmt = sysinfo_format_memory (swap_total, swap_free);
 	}
 
 	mem_fmt = sysinfo_format_memory (mem_total, mem_free);
 
-	if (swap_fmt && swap_total != 0)
+	if (swap_fmt)
 	{
 		ret = g_strdup_printf ("Physical: %s Swap: %s", mem_fmt, swap_fmt);
 		g_free (mem_fmt);