diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c index d3dd23ed9f..cf4d6b8c36 100644 --- a/contrib/plugins/hotblocks.c +++ b/contrib/plugins/hotblocks.c @@ -82,10 +82,9 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) sorted_counts = g_list_sort_with_data(counts, cmp_exec_count, NULL); 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) { + for (i = 0, it = sorted_counts; i < limit && it; i++, it = it->next) { ExecCount *rec = (ExecCount *) it->data; g_string_append_printf( report, "0x%016"PRIx64", %d, %ld, %"PRId64"\n",