From 737f87fa161e1393a8dd47aa61a782a37f22ca7d Mon Sep 17 00:00:00 2001 From: Patrick Griffis Date: Sat, 3 Sep 2016 12:29:01 -0400 Subject: [PATCH] sysinfo: Fix leak --- plugins/sysinfo/unix/backend.c | 4 ++-- 1 file 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);