diff mbox series

plugins/howvec: fix use-after-free

Message ID 20240311060456.218190-1-pierrick.bouvier@linaro.org
State New
Headers show
Series plugins/howvec: fix use-after-free | expand

Commit Message

Pierrick Bouvier March 11, 2024, 6:04 a.m. UTC
reported by coverity scan
---
 contrib/plugins/howvec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé March 11, 2024, 8:31 a.m. UTC | #1
On 11/3/24 07:04, Pierrick Bouvier wrote:
> reported by coverity scan

Reported by Coverity as CID 1539967.

> ---
>   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..5be91f6fc5c 100644
> --- a/contrib/plugins/howvec.c
> +++ b/contrib/plugins/howvec.c
> @@ -168,8 +168,8 @@ static void free_record(gpointer data)
>   {
>       InsnExecCount *rec = (InsnExecCount *) data;
>       g_free(rec->insn);
> -    g_free(rec);
>       qemu_plugin_scoreboard_free(rec->count.score);
> +    g_free(rec);
>   }
>   
>   static void plugin_exit(qemu_plugin_id_t id, void *p)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c
index 2d10c87e0fb..5be91f6fc5c 100644
--- a/contrib/plugins/howvec.c
+++ b/contrib/plugins/howvec.c
@@ -168,8 +168,8 @@  static void free_record(gpointer data)
 {
     InsnExecCount *rec = (InsnExecCount *) data;
     g_free(rec->insn);
-    g_free(rec);
     qemu_plugin_scoreboard_free(rec->count.score);
+    g_free(rec);
 }
 
 static void plugin_exit(qemu_plugin_id_t id, void *p)