* [PATCH v2 0/2] fix mismatches between g_strsplit and g_free
@ 2020-01-10 9:17 pannengyuan
2020-01-10 9:17 ` [PATCH v2 1/2] vl: Don't mismatch g_strsplit()/g_free() pannengyuan
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: pannengyuan @ 2020-01-10 9:17 UTC (permalink / raw)
To: pbonzini, mdroth
Cc: qemu-trivial, Pan Nengyuan, qemu-devel, zhang.zhanghailiang
From: Pan Nengyuan <pannengyuan@huawei.com>
v1: fix a mismatch in vl.c
v2: fix mismatch in vl.c and qga/main.c
Pan Nengyuan (2):
vl: Don't mismatch g_strsplit()/g_free()
qga/main: Don't mismatch g_strsplit/g_free in split_list()
qga/main.c | 2 +-
vl.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.21.0.windows.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] vl: Don't mismatch g_strsplit()/g_free()
2020-01-10 9:17 [PATCH v2 0/2] fix mismatches between g_strsplit and g_free pannengyuan
@ 2020-01-10 9:17 ` pannengyuan
2020-01-10 9:17 ` [PATCH v2 2/2] qga/main: Don't mismatch g_strsplit/g_free in split_list() pannengyuan
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: pannengyuan @ 2020-01-10 9:17 UTC (permalink / raw)
To: pbonzini, mdroth
Cc: qemu-trivial, Euler Robot, Pan Nengyuan, qemu-devel, zhang.zhanghailiang
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>
---
Changes v2 to v1:
- fix another on in qga/main.c
---
vl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vl.c b/vl.c
index 86474a55c9..2fa5cb3b9a 100644
--- a/vl.c
+++ b/vl.c
@@ -3476,7 +3476,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.windows.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] qga/main: Don't mismatch g_strsplit/g_free in split_list()
2020-01-10 9:17 [PATCH v2 0/2] fix mismatches between g_strsplit and g_free pannengyuan
2020-01-10 9:17 ` [PATCH v2 1/2] vl: Don't mismatch g_strsplit()/g_free() pannengyuan
@ 2020-01-10 9:17 ` pannengyuan
2020-01-10 9:41 ` Marc-André Lureau
2020-01-10 9:38 ` [PATCH v2 0/2] fix mismatches between g_strsplit and g_free no-reply
2020-01-22 15:19 ` Paolo Bonzini
3 siblings, 1 reply; 7+ messages in thread
From: pannengyuan @ 2020-01-10 9:17 UTC (permalink / raw)
To: pbonzini, mdroth
Cc: qemu-trivial, Laurent Vivier, Pan Nengyuan, qemu-devel,
zhang.zhanghailiang
From: Pan Nengyuan <pannengyuan@huawei.com>
fix a mismatch between g_strsplit and g_free
Reported-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
---
Changes v2 to v1:
- fix a mismatch in qga/main.c
---
qga/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/qga/main.c b/qga/main.c
index c35c2a2120..a72ae074f4 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -933,7 +933,7 @@ static GList *split_list(const gchar *str, const gchar *delim)
for (i = 0; strv[i]; i++) {
list = g_list_prepend(list, strv[i]);
}
- g_free(strv);
+ g_strfreev(strv);
return list;
}
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] fix mismatches between g_strsplit and g_free
2020-01-10 9:17 [PATCH v2 0/2] fix mismatches between g_strsplit and g_free pannengyuan
2020-01-10 9:17 ` [PATCH v2 1/2] vl: Don't mismatch g_strsplit()/g_free() pannengyuan
2020-01-10 9:17 ` [PATCH v2 2/2] qga/main: Don't mismatch g_strsplit/g_free in split_list() pannengyuan
@ 2020-01-10 9:38 ` no-reply
2020-01-22 15:19 ` Paolo Bonzini
3 siblings, 0 replies; 7+ messages in thread
From: no-reply @ 2020-01-10 9:38 UTC (permalink / raw)
To: pannengyuan
Cc: zhang.zhanghailiang, qemu-trivial, pannengyuan, mdroth,
qemu-devel, pbonzini
Patchew URL: https://patchew.org/QEMU/20200110091710.53424-1-pannengyuan@huawei.com/
Hi,
This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===
TEST check-unit: tests/test-crypto-cipher
TEST check-unit: tests/test-crypto-secret
TEST check-unit: tests/test-qga
ERROR - too few tests run (expected 25, got 17)
TEST iotest-qcow2: 029
make: *** [check-unit] Error 1
make: *** Waiting for unfinished jobs....
TEST iotest-qcow2: 031
TEST iotest-qcow2: 032
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=327e1beba9794e3085a9e39927d1dfe5', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-1qgcfifd/src/docker-src.2020-01-10-04.27.30.12511:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=327e1beba9794e3085a9e39927d1dfe5
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-1qgcfifd/src'
make: *** [docker-run-test-quick@centos7] Error 2
real 10m55.759s
user 0m8.010s
The full log is available at
http://patchew.org/logs/20200110091710.53424-1-pannengyuan@huawei.com/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] qga/main: Don't mismatch g_strsplit/g_free in split_list()
2020-01-10 9:17 ` [PATCH v2 2/2] qga/main: Don't mismatch g_strsplit/g_free in split_list() pannengyuan
@ 2020-01-10 9:41 ` Marc-André Lureau
2020-01-10 9:43 ` Laurent Vivier
0 siblings, 1 reply; 7+ messages in thread
From: Marc-André Lureau @ 2020-01-10 9:41 UTC (permalink / raw)
To: pannengyuan
Cc: zhanghailiang, qemu trival, QEMU, Michael Roth, Paolo Bonzini,
Laurent Vivier
Hi
On Fri, Jan 10, 2020 at 1:18 PM <pannengyuan@huawei.com> wrote:
>
> From: Pan Nengyuan <pannengyuan@huawei.com>
>
> fix a mismatch between g_strsplit and g_free
>
> Reported-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
NACK, the elements are added to the returned list.
> ---
> Changes v2 to v1:
> - fix a mismatch in qga/main.c
> ---
> qga/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/qga/main.c b/qga/main.c
> index c35c2a2120..a72ae074f4 100644
> --- a/qga/main.c
> +++ b/qga/main.c
> @@ -933,7 +933,7 @@ static GList *split_list(const gchar *str, const gchar *delim)
> for (i = 0; strv[i]; i++) {
> list = g_list_prepend(list, strv[i]);
> }
> - g_free(strv);
> + g_strfreev(strv);
>
> return list;
> }
> --
> 2.21.0.windows.1
>
>
>
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] qga/main: Don't mismatch g_strsplit/g_free in split_list()
2020-01-10 9:41 ` Marc-André Lureau
@ 2020-01-10 9:43 ` Laurent Vivier
0 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2020-01-10 9:43 UTC (permalink / raw)
To: Marc-André Lureau, pannengyuan
Cc: qemu trival, Paolo Bonzini, zhanghailiang, QEMU
Le 10/01/2020 à 10:41, Marc-André Lureau a écrit :
> Hi
>
> On Fri, Jan 10, 2020 at 1:18 PM <pannengyuan@huawei.com> wrote:
>>
>> From: Pan Nengyuan <pannengyuan@huawei.com>
>>
>> fix a mismatch between g_strsplit and g_free
>>
>> Reported-by: Laurent Vivier <laurent@vivier.eu>
>> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
>
> NACK, the elements are added to the returned list.
It's my fault, sorry...
Laurent
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] fix mismatches between g_strsplit and g_free
2020-01-10 9:17 [PATCH v2 0/2] fix mismatches between g_strsplit and g_free pannengyuan
` (2 preceding siblings ...)
2020-01-10 9:38 ` [PATCH v2 0/2] fix mismatches between g_strsplit and g_free no-reply
@ 2020-01-22 15:19 ` Paolo Bonzini
3 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2020-01-22 15:19 UTC (permalink / raw)
To: pannengyuan, mdroth; +Cc: qemu-trivial, qemu-devel, zhang.zhanghailiang
On 10/01/20 10:17, pannengyuan@huawei.com wrote:
> From: Pan Nengyuan <pannengyuan@huawei.com>
>
> v1: fix a mismatch in vl.c
> v2: fix mismatch in vl.c and qga/main.c
>
> Pan Nengyuan (2):
> vl: Don't mismatch g_strsplit()/g_free()
> qga/main: Don't mismatch g_strsplit/g_free in split_list()
>
> qga/main.c | 2 +-
> vl.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
Queued patch 1, thanks.
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-01-22 15:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10 9:17 [PATCH v2 0/2] fix mismatches between g_strsplit and g_free pannengyuan
2020-01-10 9:17 ` [PATCH v2 1/2] vl: Don't mismatch g_strsplit()/g_free() pannengyuan
2020-01-10 9:17 ` [PATCH v2 2/2] qga/main: Don't mismatch g_strsplit/g_free in split_list() pannengyuan
2020-01-10 9:41 ` Marc-André Lureau
2020-01-10 9:43 ` Laurent Vivier
2020-01-10 9:38 ` [PATCH v2 0/2] fix mismatches between g_strsplit and g_free no-reply
2020-01-22 15:19 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.