summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Bradbury <asb@igalia.com>2025-12-02 23:05:54 +0000
committerMichael Tokarev <mjt@tls.msk.ru>2026-02-12 20:51:07 +0300
commit1d6ad5e8ebdd82623aa87e2e4da993b837c1879a (patch)
treec1afb5c1a9eaaca7b7016d7a509de00b9e261661
parent2f4c5e98f9ebbf18eab068eb49ba1aa3bef2725c (diff)
downloadqemu-1d6ad5e8ebdd82623aa87e2e4da993b837c1879a.tar.gz
qemu-1d6ad5e8ebdd82623aa87e2e4da993b837c1879a.zip
contrib/plugins/hotblocks: Correctly free sorted counts list
g_list_free should be passed the head of the list. Signed-off-by: Alex Bradbury <asb@igalia.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Link: https://lore.kernel.org/qemu-devel/cf5a00136738b981a12270b76572e8d502daf208.1753857212.git.asb@igalia.com Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> (cherry picked from commit 90fabd5ddace6ffa5a62a5186201fd071b4e2b74) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--contrib/plugins/hotblocks.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
index 98404b6885..d3dd23ed9f 100644
--- a/contrib/plugins/hotblocks.c
+++ b/contrib/plugins/hotblocks.c
@@ -73,15 +73,16 @@ static void exec_count_free(gpointer key, gpointer value, gpointer user_data)
static void plugin_exit(qemu_plugin_id_t id, void *p)
{
g_autoptr(GString) report = g_string_new("collected ");
- GList *counts, *it;
+ GList *counts, *sorted_counts, *it;
int i;
g_string_append_printf(report, "%d entries in the hash table\n",
g_hash_table_size(hotblocks));
counts = g_hash_table_get_values(hotblocks);
- it = g_list_sort_with_data(counts, cmp_exec_count, NULL);
+ sorted_counts = g_list_sort_with_data(counts, cmp_exec_count, NULL);
- if (it) {
+ if (sorted_counts) {
+ it = sorted_counts;
g_string_append_printf(report, "pc, tcount, icount, ecount\n");
for (i = 0; i < limit && it->next; i++, it = it->next) {
@@ -94,7 +95,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
qemu_plugin_scoreboard_u64(rec->exec_count)));
}
- g_list_free(it);
+ g_list_free(sorted_counts);
}
qemu_plugin_outs(report->str);