tests/plugins: fix use-after-free bug
rec->count.score is inside rec, which is freed before rec->count.score is. Reorder the instructions Reported by Coverity as CID 1539967. Cc: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
7fd226b047
commit
732810235f
@ -167,9 +167,9 @@ static gint cmp_exec_count(gconstpointer a, gconstpointer b)
|
|||||||
static void free_record(gpointer data)
|
static void free_record(gpointer data)
|
||||||
{
|
{
|
||||||
InsnExecCount *rec = (InsnExecCount *) data;
|
InsnExecCount *rec = (InsnExecCount *) data;
|
||||||
|
qemu_plugin_scoreboard_free(rec->count.score);
|
||||||
g_free(rec->insn);
|
g_free(rec->insn);
|
||||||
g_free(rec);
|
g_free(rec);
|
||||||
qemu_plugin_scoreboard_free(rec->count.score);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void plugin_exit(qemu_plugin_id_t id, void *p)
|
static void plugin_exit(qemu_plugin_id_t id, void *p)
|
||||||
|
Loading…
Reference in New Issue
Block a user