From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Pan Nengyuan <pannengyuan@huawei.com>,
Euler Robot <euler.robot@huawei.com>
Subject: [PULL 1/9] vl: Don't mismatch g_strsplit()/g_free()
Date: Wed, 12 Feb 2020 17:41:21 +0100 [thread overview]
Message-ID: <20200212164129.6968-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20200212164129.6968-1-pbonzini@redhat.com>
From: Pan Nengyuan <pannengyuan@huawei.com>
It's a mismatch between g_strsplit and g_free, it will cause a memory leak as follow:
[root@localhost]# ./aarch64-softmmu/qemu-system-aarch64 -accel help
Accelerators supported in QEMU binary:
tcg
kvm
=================================================================
==1207900==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 8 byte(s) in 2 object(s) allocated from:
#0 0xfffd700231cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb)
#1 0xfffd6ec57163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
#2 0xfffd6ec724d7 in g_strndup (/lib64/libglib-2.0.so.0+0x724d7)
#3 0xfffd6ec73d3f in g_strsplit (/lib64/libglib-2.0.so.0+0x73d3f)
#4 0xaaab66be5077 in main /mnt/sdc/qemu-master/qemu-4.2.0-rc0/vl.c:3517
#5 0xfffd6e140b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
#6 0xaaab66bf0f53 (./build/aarch64-softmmu/qemu-system-aarch64+0x8a0f53)
Direct leak of 2 byte(s) in 2 object(s) allocated from:
#0 0xfffd700231cb in __interceptor_malloc (/lib64/libasan.so.4+0xd31cb)
#1 0xfffd6ec57163 in g_malloc (/lib64/libglib-2.0.so.0+0x57163)
#2 0xfffd6ec7243b in g_strdup (/lib64/libglib-2.0.so.0+0x7243b)
#3 0xfffd6ec73e6f in g_strsplit (/lib64/libglib-2.0.so.0+0x73e6f)
#4 0xaaab66be5077 in main /mnt/sdc/qemu-master/qemu-4.2.0-rc0/vl.c:3517
#5 0xfffd6e140b9f in __libc_start_main (/lib64/libc.so.6+0x20b9f)
#6 0xaaab66bf0f53 (./build/aarch64-softmmu/qemu-system-aarch64+0x8a0f53)
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Message-Id: <20200110091710.53424-2-pannengyuan@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
vl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vl.c b/vl.c
index 7dcb0879c4..c5beda7d48 100644
--- a/vl.c
+++ b/vl.c
@@ -3501,7 +3501,7 @@ int main(int argc, char **argv, char **envp)
gchar **optname = g_strsplit(typename,
ACCEL_CLASS_SUFFIX, 0);
printf("%s\n", optname[0]);
- g_free(optname);
+ g_strfreev(optname);
}
g_free(typename);
}
--
2.21.0
next prev parent reply other threads:[~2020-02-12 16:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 16:41 [PULL 0/9] Mini misc patches queue for 2020-02-12 Paolo Bonzini
2020-02-12 16:41 ` Paolo Bonzini [this message]
2020-02-12 16:41 ` [PULL 2/9] seqlock: fix seqlock_write_unlock_impl function Paolo Bonzini
2020-02-12 16:41 ` [PULL 3/9] Remove support for CLOCK_MONOTONIC not being defined Paolo Bonzini
2020-02-12 16:41 ` [PULL 4/9] minikconf: accept alnum identifiers Paolo Bonzini
2020-02-12 16:41 ` [PULL 5/9] exec: do not define use_icount for user-mode emulation Paolo Bonzini
2020-02-12 16:41 ` [PULL 6/9] build: move TARGET_GPROF to config-host.mak Paolo Bonzini
2020-02-12 16:41 ` [PULL 7/9] target/i386: fix TCG UCODE_REV access Paolo Bonzini
2020-02-12 16:41 ` [PULL 8/9] target/i386: check for availability of MSR_IA32_UCODE_REV as an emulated MSR Paolo Bonzini
2020-02-12 16:41 ` [PULL 9/9] target/i386: enable monitor and ucode revision with -cpu max Paolo Bonzini
2020-02-13 14:43 ` [PULL 0/9] Mini misc patches queue for 2020-02-12 Peter Maydell
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=20200212164129.6968-2-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=euler.robot@huawei.com \
--cc=pannengyuan@huawei.com \
--cc=qemu-devel@nongnu.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).