[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 5/6] tests/plugins: fix use-after-free bug
From: |
Paolo Bonzini |
Subject: |
[PULL 5/6] tests/plugins: fix use-after-free bug |
Date: |
Wed, 20 Mar 2024 11:32:12 +0100 |
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>
---
contrib/plugins/howvec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c
index 2d10c87e0fb..94bbc53820a 100644
--- a/contrib/plugins/howvec.c
+++ b/contrib/plugins/howvec.c
@@ -167,9 +167,9 @@ static gint cmp_exec_count(gconstpointer a, gconstpointer b)
static void free_record(gpointer data)
{
InsnExecCount *rec = (InsnExecCount *) data;
+ qemu_plugin_scoreboard_free(rec->count.score);
g_free(rec->insn);
g_free(rec);
- qemu_plugin_scoreboard_free(rec->count.score);
}
static void plugin_exit(qemu_plugin_id_t id, void *p)
--
2.44.0
- [PULL 0/6] QEMU bug fixes for 20240320, Paolo Bonzini, 2024/03/20
- [PULL 1/6] target/i386: fix direction of "32-bit MMU" test, Paolo Bonzini, 2024/03/20
- [PULL 4/6] target/i386: Revert monitor_puts() in do_inject_x86_mce(), Paolo Bonzini, 2024/03/20
- [PULL 5/6] tests/plugins: fix use-after-free bug,
Paolo Bonzini <=
- [PULL 3/6] vl: do not assert if sev-guest is used together with TCG, Paolo Bonzini, 2024/03/20
- [PULL 6/6] meson: remove dead dictionary access, Paolo Bonzini, 2024/03/20
- [PULL 2/6] vl: convert qemu_machine_creation_done() to Error **, Paolo Bonzini, 2024/03/20
- Re: [PULL 0/6] QEMU bug fixes for 20240320, Peter Maydell, 2024/03/20