qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark Kanda <mark.kanda@oracle.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, richard.henderson@linaro.org
Subject: [PATCH 3/4] cpu: Free cpu->cpu_ases in cpu_exec_unrealizefn()
Date: Wed, 26 Jan 2022 08:29:45 -0600	[thread overview]
Message-ID: <20220126142946.667782-4-mark.kanda@oracle.com> (raw)
In-Reply-To: <20220126142946.667782-1-mark.kanda@oracle.com>

vCPU hotunplug related leak reported by Valgrind:

==377357== 216 bytes in 1 blocks are definitely lost in loss record 7,042 of 8,471
==377357==    at 0x4C3ADBB: calloc (vg_replace_malloc.c:1117)
==377357==    by 0x65C14CD: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.5600.4)
==377357==    by 0x78552E: cpu_address_space_init (physmem.c:750)
==377357==    by 0x78175B: qemu_init_vcpu (cpus.c:629)
==377357==    by 0x7185A3: x86_cpu_realizefn (cpu.c:6447)
==377357==    by 0x8E46B7: device_set_realized (qdev.c:531)
==377357==    by 0x8EE36F: property_set_bool (object.c:2268)
==377357==    by 0x8EC3C5: object_property_set (object.c:1403)
==377357==    by 0x8F075D: object_property_set_qobject (qom-qobject.c:28)
==377357==    by 0x8EC72C: object_property_set_bool (object.c:1472)
==377357==    by 0x8E3F7F: qdev_realize (qdev.c:333)
==377357==    by 0x43F3A2: qdev_device_add_from_qdict (qdev-monitor.c:711)

Signed-off-by: Mark Kanda <mark.kanda@oracle.com>
---
 cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cpu.c b/cpu.c
index 016bf06a1a..d5c730164a 100644
--- a/cpu.c
+++ b/cpu.c
@@ -170,6 +170,7 @@ void cpu_exec_unrealizefn(CPUState *cpu)
     if (tcg_enabled()) {
         tcg_exec_unrealizefn(cpu);
     }
+    g_free(cpu->cpu_ases);
 
     cpu_list_remove(cpu);
 }
-- 
2.27.0



  parent reply	other threads:[~2022-01-26 14:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 14:29 [PATCH 0/4] vCPU hotunplug related memory leaks Mark Kanda
2022-01-26 14:29 ` [PATCH 1/4] softmmu/cpus: Free cpu->thread in cpu_remove_sync() Mark Kanda
2022-02-22 17:15   ` Philippe Mathieu-Daudé
2022-01-26 14:29 ` [PATCH 2/4] softmmu/cpus: Free cpu->halt_cond " Mark Kanda
2022-01-26 14:29 ` Mark Kanda [this message]
2022-01-26 14:29 ` [PATCH 4/4] i386/cpu: Free env->xsave_buf in x86_cpu_unrealizefn() Mark Kanda
2022-02-22 16:04 ` [PATCH 0/4] vCPU hotunplug related memory leaks Mark Kanda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220126142946.667782-4-mark.kanda@oracle.com \
    --to=mark.kanda@oracle.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).