From nobody Mon Apr 6 23:08:51 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1773771870; cv=none; d=zohomail.com; s=zohoarc; b=AO12vcyGlnMxBzUjG2Yi78aF8V6x4HetuWdMErRWbToAgU2CWa5ogDDGuAEG+VkAVM76n85ise5exCdcAPij9rXBtHaHykFgQZcVVBLZE12FTC9DuWKdepFRVZgEbWQzviUTgVFnVJ5Osq1exyRkRV+ajuOu/JzwoGnQiikzgNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773771870; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=b8qszfObvvrpBzl9FjAnV8XOcetgvioqDs1BJyFKlgo=; b=W/nZUk1FrTHTQThq5dpJ6kmScTmbDku/qvJinawzhHdDat9thf80N++mXTPgzC+lIGhV0obqhJbF4vNa/AIX3cculv3yJbWcoqIvuFce1UEqGwAIu09UboNT/VUg2GAjvPU1ME/skxG2r6IRQvxqRoPY8FtTBtSwiAPUi3ANE3o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177377187054522.793397343438073; Tue, 17 Mar 2026 11:24:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2Z4m-0003l2-AP; Tue, 17 Mar 2026 14:23:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2Z4k-0003ke-UG for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:30 -0400 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w2Z4j-00034A-2P for qemu-devel@nongnu.org; Tue, 17 Mar 2026 14:23:30 -0400 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5B4C54D3BC; Tue, 17 Mar 2026 18:23:25 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 35E234273B; Tue, 17 Mar 2026 18:23:23 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oDxMOxucuWnXdQAAD6G6ig (envelope-from ); Tue, 17 Mar 2026 18:23:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771805; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b8qszfObvvrpBzl9FjAnV8XOcetgvioqDs1BJyFKlgo=; b=No8xyFZpYxwgiXrFKEQgLL6N65RpfAr9q54p8JsR5G/IuZaKRexDWjmuI4tXsM8imyg7pK MyonhFRTVMVFwzuaPSNSQZLWCd+Mi9RZFHf60bOTjbYkIF5fsDjr+vcq/2Ru7VC+z3CeWp 89WZlfBt5qCAVfi8G4/SAe3u4XDjRAA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771805; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b8qszfObvvrpBzl9FjAnV8XOcetgvioqDs1BJyFKlgo=; b=ADo2kutz1HHolpjBAWS/TaMccV4aM3VkIcaWVgPK/cyPDiu0pbh16nb9wy1ExObSPn4Ckl 02aTicUJZPruEuCQ== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=No8xyFZp; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=ADo2kutz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1773771805; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b8qszfObvvrpBzl9FjAnV8XOcetgvioqDs1BJyFKlgo=; b=No8xyFZpYxwgiXrFKEQgLL6N65RpfAr9q54p8JsR5G/IuZaKRexDWjmuI4tXsM8imyg7pK MyonhFRTVMVFwzuaPSNSQZLWCd+Mi9RZFHf60bOTjbYkIF5fsDjr+vcq/2Ru7VC+z3CeWp 89WZlfBt5qCAVfi8G4/SAe3u4XDjRAA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1773771805; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b8qszfObvvrpBzl9FjAnV8XOcetgvioqDs1BJyFKlgo=; b=ADo2kutz1HHolpjBAWS/TaMccV4aM3VkIcaWVgPK/cyPDiu0pbh16nb9wy1ExObSPn4Ckl 02aTicUJZPruEuCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Xu , Prasad Pandit Subject: [PULL 01/10] tests/qtest/migration: Fix leak of migration tests data Date: Tue, 17 Mar 2026 15:23:11 -0300 Message-ID: <20260317182320.31991-2-farosas@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260317182320.31991-1-farosas@suse.de> References: <20260317182320.31991-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:mid,suse.de:dkim,suse.de:email]; ASN(0.00)[asn:32098, ipnet:2800::/6, country:US]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Spam-Score: -3.01 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 5B4C54D3BC 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; Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @suse.de) X-ZM-MESSAGEID: 1773771872232158500 Content-Type: text/plain; charset="utf-8" When the migration-test is invoked with the '-p' flag (to run a single test), the glib code won't call the destroy function for the not-executed tests, causing the MigrationTest wrapper data to leak. This doesn't affect make check, but affects debugging use-cases where having a leak pop up in ASAN output is extra annoying. Fix by adding the tests data to a list and freeing them all at the end of migration-test execution. Any tests actually dispatched by glib will have the destroy function called as usual. Note that migration_test_add_suffix() is altered to call migration_test_add() so that there's only one place adding the data to the list. Performance is not an issue at the moment, we have < 100 tests. Reviewed-by: Peter Xu Reviewed-by: Prasad Pandit Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-2-farosas@sus= e.de Signed-off-by: Fabiano Rosas --- tests/qtest/migration/framework.c | 2 ++ tests/qtest/migration/migration-util.c | 19 ++++++++++++++----- tests/qtest/migration/migration-util.h | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/fram= ework.c index 0bfc241914..b9371372de 100644 --- a/tests/qtest/migration/framework.c +++ b/tests/qtest/migration/framework.c @@ -1162,5 +1162,7 @@ int migration_env_clean(MigrationTestEnv *env) } g_free(tmpfs); =20 + migration_tests_free(); + return ret; } diff --git a/tests/qtest/migration/migration-util.c b/tests/qtest/migration= /migration-util.c index c2462306a1..2648ad7f61 100644 --- a/tests/qtest/migration/migration-util.c +++ b/tests/qtest/migration/migration-util.c @@ -38,6 +38,7 @@ #include "linux/kvm.h" #endif =20 +GQueue *tests; =20 static char *SocketAddress_to_str(SocketAddress *addr) { @@ -243,6 +244,8 @@ static void migration_test_destroy(gpointer data) { MigrationTest *test =3D (MigrationTest *)data; =20 + g_queue_remove(tests, test); + g_free(test->data); g_free(test->name); g_free(test); @@ -268,21 +271,27 @@ void migration_test_add(const char *path, =20 qtest_add_data_func_full(path, test, migration_test_wrapper, migration_test_destroy); + if (!tests) { + tests =3D g_queue_new(); + } + g_queue_push_tail(tests, test); } =20 void migration_test_add_suffix(const char *path, const char *suffix, void (*fn)(char *name, MigrateCommon *args)) { - MigrationTest *test =3D g_new0(MigrationTest, 1); + g_autofree char *name =3D NULL; =20 g_assert(g_str_has_suffix(path, "/")); g_assert(!g_str_has_prefix(suffix, "/")); =20 - test->func =3D fn; - test->name =3D g_strconcat(path, suffix, NULL); + name =3D g_strconcat(path, suffix, NULL); + migration_test_add(name, fn); +} =20 - qtest_add_data_func_full(test->name, test, migration_test_wrapper, - migration_test_destroy); +void migration_tests_free(void) +{ + g_queue_free_full(tests, migration_test_destroy); } =20 #ifdef O_DIRECT diff --git a/tests/qtest/migration/migration-util.h b/tests/qtest/migration= /migration-util.h index e73d69bab0..694773e594 100644 --- a/tests/qtest/migration/migration-util.h +++ b/tests/qtest/migration/migration-util.h @@ -59,5 +59,5 @@ void migration_test_add_suffix(const char *path, const ch= ar *suffix, void (*fn)(char *name, MigrateCommon *args)= ); char *migrate_get_connect_uri(QTestState *who); void migrate_set_ports(QTestState *to, QList *channel_list); - +void migration_tests_free(void); #endif /* MIGRATION_UTIL_H */ --=20 2.51.0