diff options
Diffstat (limited to 'hardinfo2/arch/linux')
-rw-r--r-- | hardinfo2/arch/linux/common/devmemory.h | 26 | ||||
-rw-r--r-- | hardinfo2/arch/linux/common/storage.h | 6 |
2 files changed, 17 insertions, 15 deletions
diff --git a/hardinfo2/arch/linux/common/devmemory.h b/hardinfo2/arch/linux/common/devmemory.h index ca8ec4e6..c7ffdc08 100644 --- a/hardinfo2/arch/linux/common/devmemory.h +++ b/hardinfo2/arch/linux/common/devmemory.h @@ -18,7 +18,7 @@ static void __scan_memory() { - gchar **keys; + gchar **keys, *tmp; gint i; g_file_get_contents("/proc/meminfo", &meminfo, NULL, NULL); @@ -26,23 +26,31 @@ static void __scan_memory() keys = g_strsplit(meminfo, "\n", 0); g_free(meminfo); - meminfo = ""; - g_free(lginterval); - lginterval = ""; + + meminfo = g_strdup(""); + lginterval = g_strdup(""); for (i = 0; keys[i]; i++) { gchar **newkeys = g_strsplit(keys[i], ":", 0); - if (!newkeys[0]) break; + if (!newkeys[0]) { + g_strfreev(newkeys); + break; + } g_strstrip(newkeys[1]); g_hash_table_replace(moreinfo, g_strdup(newkeys[0]), g_strdup(newkeys[1])); - meminfo = g_strconcat(meminfo, newkeys[0], "=", newkeys[1], "\n", NULL); - lginterval = g_strconcat(lginterval, - "LoadGraphInterval$", newkeys[0], "=500\n", - "UpdateInterval$", newkeys[0], "=500\n", NULL); + tmp = g_strconcat(meminfo, newkeys[0], "=", newkeys[1], "\n", NULL); + g_free(meminfo); + meminfo = tmp; + + tmp = g_strconcat(lginterval, + "LoadGraphInterval$", newkeys[0], "=500\n", + "UpdateInterval$", newkeys[0], "=500\n", NULL); + g_free(lginterval); + lginterval = tmp; g_strfreev(newkeys); } diff --git a/hardinfo2/arch/linux/common/storage.h b/hardinfo2/arch/linux/common/storage.h index 8e248d3b..836ba7ea 100644 --- a/hardinfo2/arch/linux/common/storage.h +++ b/hardinfo2/arch/linux/common/storage.h @@ -22,8 +22,6 @@ static gboolean remove_scsi_devices(gpointer key, gpointer value, gpointer data) { if (!strncmp((gchar *) key, "SCSI", 4)) { - g_free((gchar *) key); - g_free((GtkTreeIter *) value); return TRUE; } return FALSE; @@ -150,15 +148,11 @@ static gboolean remove_ide_devices(gpointer key, gpointer value, gpointer data) { if (!strncmp((gchar *) key, "IDE", 3)) { - g_free((gchar *) key); - g_free((gchar *) value); - return TRUE; } return FALSE; } - void __scan_ide_devices(void) { |