qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux-user: fix memory leak when threads exit
@ 2022-05-28 11:50 kkhaike
  0 siblings, 0 replies; only message in thread
From: kkhaike @ 2022-05-28 11:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, richard.henderson, kkHAIKE

From: kkHAIKE <kkhaike@gmail.com>

when call do_fork->cpu_copy->cpu_create, the return new cpu was not parent so refby '/unattached', so need add more object_unparent call to unref.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/866
Signed-off-by: kkHAIKE <kkhaike@gmail.com>
---
 linux-user/syscall.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f55cdebee5..c653897d32 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8567,6 +8567,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
             TaskState *ts = cpu->opaque;
 
             object_property_set_bool(OBJECT(cpu), "realized", false, NULL);
+            object_unparent(OBJECT(cpu));
             object_unref(OBJECT(cpu));
             /*
              * At this point the CPU should be unrealized and removed
-- 
2.32.1 (Apple Git-133)



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-28 12:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-28 11:50 [PATCH] linux-user: fix memory leak when threads exit kkhaike

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).