Re: [PATCH] migration: fix memory leak in qmp_migrate_set_parameters

2020-08-27 Thread Dr. David Alan Gilbert
* Chuan Zheng (zhengch...@huawei.com) wrote:
> From: Zheng Chuan 
> 
> "tmp.tls_hostname" and "tmp.tls_creds" allocated by 
> migrate_params_test_apply()
> is forgot to free at the end of qmp_migrate_set_parameters(). Fix that.
> 
> The leak stack:
> Direct leak of 2 byte(s) in 2 object(s) allocated from:
>#0 0xb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd320b)
>#1 0xb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b)
>#2 0xb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143)
>#3 0xc52447fb in migrate_params_test_apply 
> (/usr/src/debug/qemu-4.1.0/migration/migration.c:1377)
>#4 0xc52fdca7 in qmp_migrate_set_parameters 
> (/usr/src/debug/qemu-4.1.0/qapi/qapi-commands-migration.c:192)
>#5 0xc551d543 in qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/qapi/qmp-dispatch.c:165)
>#6 0xc52a0a8f in qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:125)
>#7 0xc52a1c7f in monitor_qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:214)
>#8 0xc55cb0cf in aio_bh_call 
> (/usr/src/debug/qemu-4.1.0/util/async.c:117)
>#9 0xc55d4543 in aio_bh_poll 
> (/usr/src/debug/qemu-4.1.0/util/aio-posix.c:459)
>#10 0xc55cae0f in aio_dispatch 
> (/usr/src/debug/qemu-4.1.0/util/async.c:268)
>#11 0xb52d6a7b in g_main_context_dispatch 
> (/usr/lib64/libglib-2.0.so.0+0x52a7b)
>#12 0xc55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b)
>#13 0xc4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb)
>#14 0xc47f45ef(/usr/bin/qemu-kvm-4.1.0+0x8455ef)
>#15 0xb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f)
>#16 0xc47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb)
> 
> Direct leak of 2 byte(s) in 2 object(s) allocated from:
>#0 0xb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd320b)
>#1 0xb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b)
>#2 0xb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143)
>#3 0xc5244893 in migrate_params_test_apply 
> (/usr/src/debug/qemu-4.1.0/migration/migration.c:1382)
>#4 0xc52fdca7 in qmp_migrate_set_parameters 
> (/usr/src/debug/qemu-4.1.0/qapi/qapi-commands-migration.c:192)
>#5 0xc551d543 in qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/qapi/qmp-dispatch.c)
>#6 0xc52a0a8f in qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:125)
>#7 0xc52a1c7f in monitor_qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:214)
>#8 0xc55cb0cf in aio_bh_call 
> (/usr/src/debug/qemu-4.1.0/util/async.c:117)
>#9 0xc55d4543 in aio_bh_poll 
> (/usr/src/debug/qemu-4.1.0/util/aio-posix.c:459)
>#10 0xc55cae0f in in aio_dispatch 
> (/usr/src/debug/qemu-4.1.0/util/async.c:268)
>#11 0xb52d6a7b in g_main_context_dispatch 
> (/usr/lib64/libglib-2.0.so.0+0x52a7b)
>#12 0xc55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b)
>#13 0xc4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb)
>#14 0xc47f45ef (/usr/bin/qemu-kvm-4.1.0+0x8455ef)
>#15 0xb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f)
>#16 0xc47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb)
> 
> Signed-off-by: Chuan Zheng 
> Reviewed-by: KeQian Zhu 
> Reviewed-by: HaiLiang 

Queued

> ---
>  migration/migration.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 92e44e0..045180c 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1342,12 +1342,12 @@ static void 
> migrate_params_test_apply(MigrateSetParameters *params,
>  
>  if (params->has_tls_creds) {
>  assert(params->tls_creds->type == QTYPE_QSTRING);
> -dest->tls_creds = g_strdup(params->tls_creds->u.s);
> +dest->tls_creds = params->tls_creds->u.s;
>  }
>  
>  if (params->has_tls_hostname) {
>  assert(params->tls_hostname->type == QTYPE_QSTRING);
> -dest->tls_hostname = g_strdup(params->tls_hostname->u.s);
> +dest->tls_hostname = params->tls_hostname->u.s;
>  }
>  
>  if (params->has_max_bandwidth) {
> -- 
> 1.8.3.1
> 
> 
-- 
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK




Re: [PATCH] migration: fix memory leak in qmp_migrate_set_parameters

2020-07-09 Thread Juan Quintela
Chuan Zheng  wrote:
> From: Zheng Chuan 
>
> "tmp.tls_hostname" and "tmp.tls_creds" allocated by 
> migrate_params_test_apply()
> is forgot to free at the end of qmp_migrate_set_parameters(). Fix that.
>
> The leak stack:
> Direct leak of 2 byte(s) in 2 object(s) allocated from:
>#0 0xb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd320b)
>#1 0xb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b)
>#2 0xb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143)
>#3 0xc52447fb in migrate_params_test_apply 
> (/usr/src/debug/qemu-4.1.0/migration/migration.c:1377)
>#4 0xc52fdca7 in qmp_migrate_set_parameters 
> (/usr/src/debug/qemu-4.1.0/qapi/qapi-commands-migration.c:192)
>#5 0xc551d543 in qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/qapi/qmp-dispatch.c:165)
>#6 0xc52a0a8f in qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:125)
>#7 0xc52a1c7f in monitor_qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:214)
>#8 0xc55cb0cf in aio_bh_call 
> (/usr/src/debug/qemu-4.1.0/util/async.c:117)
>#9 0xc55d4543 in aio_bh_poll 
> (/usr/src/debug/qemu-4.1.0/util/aio-posix.c:459)
>#10 0xc55cae0f in aio_dispatch 
> (/usr/src/debug/qemu-4.1.0/util/async.c:268)
>#11 0xb52d6a7b in g_main_context_dispatch 
> (/usr/lib64/libglib-2.0.so.0+0x52a7b)
>#12 0xc55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b)
>#13 0xc4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb)
>#14 0xc47f45ef(/usr/bin/qemu-kvm-4.1.0+0x8455ef)
>#15 0xb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f)
>#16 0xc47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb)
>
> Direct leak of 2 byte(s) in 2 object(s) allocated from:
>#0 0xb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd320b)
>#1 0xb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b)
>#2 0xb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143)
>#3 0xc5244893 in migrate_params_test_apply 
> (/usr/src/debug/qemu-4.1.0/migration/migration.c:1382)
>#4 0xc52fdca7 in qmp_migrate_set_parameters 
> (/usr/src/debug/qemu-4.1.0/qapi/qapi-commands-migration.c:192)
>#5 0xc551d543 in qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/qapi/qmp-dispatch.c)
>#6 0xc52a0a8f in qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:125)
>#7 0xc52a1c7f in monitor_qmp_dispatch 
> (/usr/src/debug/qemu-4.1.0/monitor/qmp.c:214)
>#8 0xc55cb0cf in aio_bh_call 
> (/usr/src/debug/qemu-4.1.0/util/async.c:117)
>#9 0xc55d4543 in aio_bh_poll 
> (/usr/src/debug/qemu-4.1.0/util/aio-posix.c:459)
>#10 0xc55cae0f in in aio_dispatch 
> (/usr/src/debug/qemu-4.1.0/util/async.c:268)
>#11 0xb52d6a7b in g_main_context_dispatch 
> (/usr/lib64/libglib-2.0.so.0+0x52a7b)
>#12 0xc55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b)
>#13 0xc4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb)
>#14 0xc47f45ef (/usr/bin/qemu-kvm-4.1.0+0x8455ef)
>#15 0xb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f)
>#16 0xc47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb)
>
> Signed-off-by: Chuan Zheng 
> Reviewed-by: KeQian Zhu 
> Reviewed-by: HaiLiang 

Nice catch.

Reviewed-by: Juan Quintela 

Queued.

> ---
>  migration/migration.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 92e44e0..045180c 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1342,12 +1342,12 @@ static void 
> migrate_params_test_apply(MigrateSetParameters *params,
>  
>  if (params->has_tls_creds) {
>  assert(params->tls_creds->type == QTYPE_QSTRING);
> -dest->tls_creds = g_strdup(params->tls_creds->u.s);
> +dest->tls_creds = params->tls_creds->u.s;
>  }
>  
>  if (params->has_tls_hostname) {
>  assert(params->tls_hostname->type == QTYPE_QSTRING);
> -dest->tls_hostname = g_strdup(params->tls_hostname->u.s);
> +dest->tls_hostname = params->tls_hostname->u.s;
>  }
>  
>  if (params->has_max_bandwidth) {




[PATCH] migration: fix memory leak in qmp_migrate_set_parameters

2020-07-09 Thread Chuan Zheng
From: Zheng Chuan 

"tmp.tls_hostname" and "tmp.tls_creds" allocated by migrate_params_test_apply()
is forgot to free at the end of qmp_migrate_set_parameters(). Fix that.

The leak stack:
Direct leak of 2 byte(s) in 2 object(s) allocated from:
   #0 0xb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd320b)
   #1 0xb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b)
   #2 0xb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143)
   #3 0xc52447fb in migrate_params_test_apply 
(/usr/src/debug/qemu-4.1.0/migration/migration.c:1377)
   #4 0xc52fdca7 in qmp_migrate_set_parameters 
(/usr/src/debug/qemu-4.1.0/qapi/qapi-commands-migration.c:192)
   #5 0xc551d543 in qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/qapi/qmp-dispatch.c:165)
   #6 0xc52a0a8f in qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/monitor/qmp.c:125)
   #7 0xc52a1c7f in monitor_qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/monitor/qmp.c:214)
   #8 0xc55cb0cf in aio_bh_call (/usr/src/debug/qemu-4.1.0/util/async.c:117)
   #9 0xc55d4543 in aio_bh_poll 
(/usr/src/debug/qemu-4.1.0/util/aio-posix.c:459)
   #10 0xc55cae0f in aio_dispatch 
(/usr/src/debug/qemu-4.1.0/util/async.c:268)
   #11 0xb52d6a7b in g_main_context_dispatch 
(/usr/lib64/libglib-2.0.so.0+0x52a7b)
   #12 0xc55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b)
   #13 0xc4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb)
   #14 0xc47f45ef(/usr/bin/qemu-kvm-4.1.0+0x8455ef)
   #15 0xb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f)
   #16 0xc47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb)

Direct leak of 2 byte(s) in 2 object(s) allocated from:
   #0 0xb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd320b)
   #1 0xb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b)
   #2 0xb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143)
   #3 0xc5244893 in migrate_params_test_apply 
(/usr/src/debug/qemu-4.1.0/migration/migration.c:1382)
   #4 0xc52fdca7 in qmp_migrate_set_parameters 
(/usr/src/debug/qemu-4.1.0/qapi/qapi-commands-migration.c:192)
   #5 0xc551d543 in qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/qapi/qmp-dispatch.c)
   #6 0xc52a0a8f in qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/monitor/qmp.c:125)
   #7 0xc52a1c7f in monitor_qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/monitor/qmp.c:214)
   #8 0xc55cb0cf in aio_bh_call (/usr/src/debug/qemu-4.1.0/util/async.c:117)
   #9 0xc55d4543 in aio_bh_poll 
(/usr/src/debug/qemu-4.1.0/util/aio-posix.c:459)
   #10 0xc55cae0f in in aio_dispatch 
(/usr/src/debug/qemu-4.1.0/util/async.c:268)
   #11 0xb52d6a7b in g_main_context_dispatch 
(/usr/lib64/libglib-2.0.so.0+0x52a7b)
   #12 0xc55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b)
   #13 0xc4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb)
   #14 0xc47f45ef (/usr/bin/qemu-kvm-4.1.0+0x8455ef)
   #15 0xb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f)
   #16 0xc47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb)

Signed-off-by: Chuan Zheng 
Reviewed-by: KeQian Zhu 
Reviewed-by: HaiLiang 
---
 migration/migration.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index 92e44e0..045180c 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1342,12 +1342,12 @@ static void 
migrate_params_test_apply(MigrateSetParameters *params,
 
 if (params->has_tls_creds) {
 assert(params->tls_creds->type == QTYPE_QSTRING);
-dest->tls_creds = g_strdup(params->tls_creds->u.s);
+dest->tls_creds = params->tls_creds->u.s;
 }
 
 if (params->has_tls_hostname) {
 assert(params->tls_hostname->type == QTYPE_QSTRING);
-dest->tls_hostname = g_strdup(params->tls_hostname->u.s);
+dest->tls_hostname = params->tls_hostname->u.s;
 }
 
 if (params->has_max_bandwidth) {
-- 
1.8.3.1




Re: [PATCH] migration: fix memory leak in qmp_migrate_set_parameters

2020-07-08 Thread no-reply
Patchew URL: 
https://patchew.org/QEMU/1594266433-21621-1-git-send-email-zhengch...@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 ===

  TESTcheck-qtest-aarch64: tests/qtest/boot-serial-test
  TESTcheck-unit: tests/test-iov
  TESTcheck-qtest-aarch64: tests/qtest/migration-test
*** Error in `aarch64-softmmu/qemu-system-aarch64': malloc(): smallbin double 
linked list corrupted: 0x55573094ba50 ***
=== Backtrace: =
/lib64/libc.so.6(+0x7f3e4)[0x7f91ffa203e4]
/lib64/libc.so.6(+0x82b20)[0x7f91ffa23b20]
---
ff60-ff601000 r-xp  00:00 0  
[vsyscall]
Broken pipe
/tmp/qemu-test/src/tests/qtest/libqtest.c:175: kill_qemu() detected QEMU death 
from signal 6 (Aborted) (core dumped)
ERROR - too few tests run (expected 17, got 0)
make: *** [check-qtest-aarch64] Error 1
make: *** Waiting for unfinished jobs
  TESTcheck-unit: tests/test-bitmap
  TESTcheck-unit: tests/test-aio
---
  TESTcheck-qtest-x86_64: tests/qtest/test-filter-mirror
  TESTcheck-qtest-x86_64: tests/qtest/test-filter-redirector
  TESTcheck-qtest-x86_64: tests/qtest/migration-test
*** Error in `x86_64-softmmu/qemu-system-x86_64': malloc(): smallbin double 
linked list corrupted: 0x55acb436fc20 ***
=== Backtrace: =
/lib64/libc.so.6(+0x7f3e4)[0x7fe7408803e4]
/lib64/libc.so.6(+0x82b20)[0x7fe740883b20]
---
ff60-ff601000 r-xp  00:00 0  
[vsyscall]
Broken pipe
/tmp/qemu-test/src/tests/qtest/libqtest.c:175: kill_qemu() detected QEMU death 
from signal 6 (Aborted) (core dumped)
ERROR - too few tests run (expected 17, got 0)
make: *** [check-qtest-x86_64] Error 1
  TESTiotest-qcow2: 040
  TESTiotest-qcow2: 041
  TESTiotest-qcow2: 042
---
Not run: 259
Failures: 181
Failed 1 of 119 iotests
make: *** [check-tests/check-block.sh] Error 1
Traceback (most recent call last):
  File "./tests/docker/docker.py", line 669, in 
sys.exit(main())
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', 
'--label', 'com.qemu.instance.uuid=3acbdaa9eced4b7c8e7cca8159422d78', '-u', 
'1001', '--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/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', 
'/var/tmp/patchew-tester-tmp-re3_8n35/src/docker-src.2020-07-09-00.28.42.1742:/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=3acbdaa9eced4b7c8e7cca8159422d78
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-re3_8n35/src'
make: *** [docker-run-test-quick@centos7] Error 2

real16m47.593s
user0m9.152s


The full log is available at
http://patchew.org/logs/1594266433-21621-1-git-send-email-zhengch...@huawei.com/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-de...@redhat.com

[PATCH] migration: fix memory leak in qmp_migrate_set_parameters

2020-07-08 Thread Chuan Zheng
From: Zheng Chuan 

"tmp.tls_hostname" and "tmp.tls_creds" allocated by migrate_params_test_apply()
is forgot to free at the end of qmp_migrate_set_parameters(). Fix that.

The leak stack:
Direct leak of 2 byte(s) in 2 object(s) allocated from:
   #0 0xb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd320b)
   #1 0xb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b)
   #2 0xb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143)
   #3 0xc52447fb in migrate_params_test_apply 
(/usr/src/debug/qemu-4.1.0/migration/migration.c:1377)
   #4 0xc52fdca7 in qmp_migrate_set_parameters 
(/usr/src/debug/qemu-4.1.0/qapi/qapi-commands-migration.c:192)
   #5 0xc551d543 in qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/qapi/qmp-dispatch.c:165)
   #6 0xc52a0a8f in qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/monitor/qmp.c:125)
   #7 0xc52a1c7f in monitor_qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/monitor/qmp.c:214)
   #8 0xc55cb0cf in aio_bh_call (/usr/src/debug/qemu-4.1.0/util/async.c:117)
   #9 0xc55d4543 in aio_bh_poll 
(/usr/src/debug/qemu-4.1.0/util/aio-posix.c:459)
   #10 0xc55cae0f in aio_dispatch 
(/usr/src/debug/qemu-4.1.0/util/async.c:268)
   #11 0xb52d6a7b in g_main_context_dispatch 
(/usr/lib64/libglib-2.0.so.0+0x52a7b)
   #12 0xc55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b)
   #13 0xc4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb)
   #14 0xc47f45ef(/usr/bin/qemu-kvm-4.1.0+0x8455ef)
   #15 0xb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f)
   #16 0xc47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb)

Direct leak of 2 byte(s) in 2 object(s) allocated from:
   #0 0xb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd320b)
   #1 0xb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b)
   #2 0xb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143)
   #3 0xc5244893 in migrate_params_test_apply 
(/usr/src/debug/qemu-4.1.0/migration/migration.c:1382)
   #4 0xc52fdca7 in qmp_migrate_set_parameters 
(/usr/src/debug/qemu-4.1.0/qapi/qapi-commands-migration.c:192)
   #5 0xc551d543 in qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/qapi/qmp-dispatch.c)
   #6 0xc52a0a8f in qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/monitor/qmp.c:125)
   #7 0xc52a1c7f in monitor_qmp_dispatch 
(/usr/src/debug/qemu-4.1.0/monitor/qmp.c:214)
   #8 0xc55cb0cf in aio_bh_call (/usr/src/debug/qemu-4.1.0/util/async.c:117)
   #9 0xc55d4543 in aio_bh_poll 
(/usr/src/debug/qemu-4.1.0/util/aio-posix.c:459)
   #10 0xc55cae0f in in aio_dispatch 
(/usr/src/debug/qemu-4.1.0/util/async.c:268)
   #11 0xb52d6a7b in g_main_context_dispatch 
(/usr/lib64/libglib-2.0.so.0+0x52a7b)
   #12 0xc55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b)
   #13 0xc4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb)
   #14 0xc47f45ef (/usr/bin/qemu-kvm-4.1.0+0x8455ef)
   #15 0xb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f)
   #16 0xc47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb)

Signed-off-by: Chuan Zheng 
Reviewed-by: KeQian Zhu 
Reviewed-by: HaiLiang 
---
 migration/migration.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/migration/migration.c b/migration/migration.c
index 92e44e0..6edee04 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1529,10 +1529,13 @@ void qmp_migrate_set_parameters(MigrateSetParameters 
*params, Error **errp)
 
 if (!migrate_params_check(, errp)) {
 /* Invalid parameter */
-return;
+goto out;
 }
 
 migrate_params_apply(params, errp);
+out:
+g_free(tmp.tls_hostname);
+g_free(tmp.tls_creds);
 }
 
 
-- 
1.8.3.1