sysinfo: Fix leak
This commit is contained in:
parent
4658c5d4e5
commit
737f87fa16
@ -60,14 +60,14 @@ char *sysinfo_backend_get_memory(void)
|
|||||||
{
|
{
|
||||||
return NULL;
|
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);
|
swap_fmt = sysinfo_format_memory (swap_total, swap_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
mem_fmt = sysinfo_format_memory (mem_total, mem_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);
|
ret = g_strdup_printf ("Physical: %s Swap: %s", mem_fmt, swap_fmt);
|
||||||
g_free (mem_fmt);
|
g_free (mem_fmt);
|
||||||
|
Loading…
Reference in New Issue
Block a user