From: kkhaike@gmail.com
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu, richard.henderson@linaro.org,
kkHAIKE <kkhaike@gmail.com>
Subject: [PATCH] linux-user: fix memory leak when threads exit
Date: Sat, 28 May 2022 19:50:44 +0800 [thread overview]
Message-ID: <20220528115044.30813-1-kkhaike@gmail.com> (raw)
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)
reply other threads:[~2022-05-28 12:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220528115044.30813-1-kkhaike@gmail.com \
--to=kkhaike@gmail.com \
--cc=laurent@vivier.eu \
--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).