qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] plugins/howvec: fix use-after-free
@ 2024-03-11  6:04 Pierrick Bouvier
  2024-03-11  8:31 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Pierrick Bouvier @ 2024-03-11  6:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mahmoud Mandour, Alexandre Iooss, Pierrick Bouvier,
	Alex Bennée

reported by coverity scan
---
 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)
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] plugins/howvec: fix use-after-free
  2024-03-11  6:04 [PATCH] plugins/howvec: fix use-after-free Pierrick Bouvier
@ 2024-03-11  8:31 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-03-11  8:31 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: Mahmoud Mandour, Alexandre Iooss, Alex Bennée

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>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-11  8:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-11  6:04 [PATCH] plugins/howvec: fix use-after-free Pierrick Bouvier
2024-03-11  8:31 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).