From nobody Thu Nov 13 14:57:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581409884957506.57361141634635; Tue, 11 Feb 2020 00:31:24 -0800 (PST) Received: from localhost ([::1]:45074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1Qx1-0000eD-Nl for importer@patchew.org; Tue, 11 Feb 2020 03:31:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48978) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1Qw7-0000CG-2k for qemu-devel@nongnu.org; Tue, 11 Feb 2020 03:30:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1Qw5-0002SH-GT for qemu-devel@nongnu.org; Tue, 11 Feb 2020 03:30:26 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:57882 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j1Qw5-00021f-2S for qemu-devel@nongnu.org; Tue, 11 Feb 2020 03:30:25 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D04F2B3062E6468881E9; Tue, 11 Feb 2020 16:30:15 +0800 (CST) Received: from localhost.localdomain (10.175.104.216) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Tue, 11 Feb 2020 16:30:09 +0800 From: To: , , , , Subject: [PATCH] migration-test: fix some memleaks in migration-test Date: Tue, 11 Feb 2020 16:45:57 +0800 Message-ID: <20200211084557.32109-1-pannengyuan@huawei.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 X-Originating-IP: [10.175.104.216] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 45.249.212.35 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pan Nengyuan , qemu-devel@nongnu.org, zhang.zhanghailiang@huawei.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pan Nengyuan spotted by asan, 'check-qtest-aarch64' runs fail if sanitizers is enabled. Reported-by: Euler Robot Signed-off-by: Pan Nengyuan Reviewed-by: Juan Quintela Reviewed-by: Laurent Vivier --- tests/qtest/migration-test.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index cf27ebbc9d..2bb214c87f 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -498,11 +498,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, const char *arch =3D qtest_get_arch(); const char *machine_opts =3D NULL; const char *memory_size; + int ret =3D 0; =20 if (args->use_shmem) { if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { g_test_skip("/dev/shm is not supported"); - return -1; + ret =3D -1; + goto out; } } =20 @@ -611,8 +613,9 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_free(shmem_path); } =20 +out: migrate_start_destroy(args); - return 0; + return ret; } =20 static void test_migrate_end(QTestState *from, QTestState *to, bool test_d= est) @@ -1134,6 +1137,8 @@ static void test_validate_uuid(void) { MigrateStart *args =3D migrate_start_new(); =20 + g_free(args->opts_source); + g_free(args->opts_target); args->opts_source =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); args->opts_target =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); do_test_validate_uuid(args, false); @@ -1143,6 +1148,8 @@ static void test_validate_uuid_error(void) { MigrateStart *args =3D migrate_start_new(); =20 + g_free(args->opts_source); + g_free(args->opts_target); args->opts_source =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); args->opts_target =3D g_strdup("-uuid 22222222-2222-2222-2222-22222222= 2222"); args->hide_stderr =3D true; @@ -1153,6 +1160,7 @@ static void test_validate_uuid_src_not_set(void) { MigrateStart *args =3D migrate_start_new(); =20 + g_free(args->opts_target); args->opts_target =3D g_strdup("-uuid 22222222-2222-2222-2222-22222222= 2222"); args->hide_stderr =3D true; do_test_validate_uuid(args, false); @@ -1162,6 +1170,7 @@ static void test_validate_uuid_dst_not_set(void) { MigrateStart *args =3D migrate_start_new(); =20 + g_free(args->opts_source); args->opts_source =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); args->hide_stderr =3D true; do_test_validate_uuid(args, false); @@ -1379,6 +1388,7 @@ static void test_multifd_tcp_cancel(void) " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}"= ); qobject_unref(rsp); =20 + g_free(uri); uri =3D migrate_get_socket_address(to2, "socket-address"); =20 wait_for_migration_status(from, "cancelled", NULL); --=20 2.18.1