qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] plugins/hotpages: Properly freed the hash table values


From: Mahmoud Mandour
Subject: [PATCH 2/2] plugins/hotpages: Properly freed the hash table values
Date: Wed, 21 Apr 2021 16:09:34 +0200

Freed the values stored in the hash table ``pages``
returned by ``g_hash_table_get_values()`` by freeing the sorted
list and destroyed the hash table afterward.

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
---
 contrib/plugins/hotpages.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/plugins/hotpages.c b/contrib/plugins/hotpages.c
index bf53267532..2094ebd15f 100644
--- a/contrib/plugins/hotpages.c
+++ b/contrib/plugins/hotpages.c
@@ -94,9 +94,10 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
                                    rec->cpu_read, rec->reads,
                                    rec->cpu_write, rec->writes);
         }
-        g_list_free(it);
+        g_list_free_full(it, g_free);
     }
 
+    g_hash_table_destroy(pages);
     qemu_plugin_outs(report->str);
 }
 
-- 
2.25.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]