From nobody Mon Nov 25 02:08:53 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1719495695; cv=none; d=zohomail.com; s=zohoarc; b=l1Lr0vxvszrYO7gRKAVWEuB5WdH/z8+0f13Pl3xsHsmS/Du3Vkn8tmg5ZyaDmAQ2+IzCA+tdZQ3JTd2dM+oezYblVhEdPWXbwcjwy0tkY4KTndEayzmLPKziNbgX2yPsi4BV8oKit8QFGnnt88jJt9sehPh5S+w6bcwjqDciuNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719495695; h=Content-Type: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=Yvl4pAdGzIA/y7zkDQtF9iZK7ptxPpuy1nIWlUirby4=; b=S/0h2NxEvzBQ5Ar7TBNuCP3oMWMwIFrx1lR9FN8f5DPZHTeU9+GthumXftvcGP326Sch8BBY9nPHMUaoNyuvGG0ywR8E/ih7EtOklTsRqEZnBksouuqUp63tAIqACgY31mm6ngUutwFOjWH+Md52zM0Qe17xSwO1o2QKLCf7Y84= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719495695822908.9952443304566; Thu, 27 Jun 2024 06:41:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMpLN-0001cr-7U; Thu, 27 Jun 2024 09:39:21 -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 1sMpLI-0001af-CE for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:16 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMpLG-0006WH-LX for qemu-devel@nongnu.org; Thu, 27 Jun 2024 09:39:16 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-7182a634815so4429106a12.3 for ; Thu, 27 Jun 2024 06:39:12 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:9ac7:6d57:2b16:6932]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac9a73fcsm13434485ad.252.2024.06.27.06.39.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 06:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719495551; x=1720100351; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Yvl4pAdGzIA/y7zkDQtF9iZK7ptxPpuy1nIWlUirby4=; b=uaF7zszFj+kz80phxfb8lk1Ot7je7a0Yr3pvZry3QyHavtrSngDzdm41+eZIv469fw Ay8TA826kLpRlqmQP5XbY8ZxQSfuFCWcllxD1aFf9CPfwREnX04rt3BcYUekDP03HV4g zV2QzWwxSQRfY2cwGs8E+EvunT4q2BsKRoyHN4+jJ9YTw/N2ahjP4oTZdK+LWs/UFnQu rpeLmkuMFzLErtn3dPJ0qccx/gUeTVI9QLTPzfxUGkB88i82CkXVJxQnNZSlsig7+7QS 0RN4olyKeat03LnZdY7tGSbvqlXWizIZsfq/kVl8q3ia3PBrQq3pAQ8SOvT8EeuNCdtl bRNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719495551; x=1720100351; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yvl4pAdGzIA/y7zkDQtF9iZK7ptxPpuy1nIWlUirby4=; b=k+VAIeG7VYnUpJ5JohNmNhYmjC+LPmDLqbXs0dYR5hkWSGMtNV8ZBtHBQheHiT7krF y49bJyQoKraqtlZRSzSJTd8Hb/psqQbY3hq6t02meSmUcb/loFBDVczgPjAjweflzL2H M+YtOi+YEtmqIjAS12yBNMN/zEk3VZHHgrG5tl/zRcBDAofhVCgtQixEYNHNhDjY9137 FNVW/4lWlF2rMRYpK6LgjW+BRKPBFpootLrHWfxH+j1NHBLatPqZPk+rAJvd4e+QSO5O ww+LNVWJD/GFog3bquWfoSP/drF8G+z5rtTTFIJP0b8RdKyn8YzPW1z096qHfMDqeiwP mEPA== X-Gm-Message-State: AOJu0Yy5Cy2rF5WGhSBWB6QdhDnIXzIsYzO3a4rs3IKtNB+Ih+QizhA1 5OOxRJYotnShMPvVfWK2r1S2bOTcyIGBGNYMeTH5peJJb7ev29UIWpQS1PLRAzc= X-Google-Smtp-Source: AGHT+IFlBGhq8j7ZQMV5qMOOdFsofTqP+NF+lT2o/+u4EH2nCOdF15FzOTWiA/9TuXR60cGyfzX9NA== X-Received: by 2002:a05:6a20:12c3:b0:1be:cbe9:f765 with SMTP id adf61e73a8af0-1becbe9f89amr3175993637.18.1719495551639; Thu, 27 Jun 2024 06:39:11 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 22:37:53 +0900 Subject: [PATCH v2 10/15] tests/qtest: Use qtest_add_data_func_full() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240627-san-v2-10-750bb0946dbd@daynix.com> References: <20240627-san-v2-0-750bb0946dbd@daynix.com> In-Reply-To: <20240627-san-v2-0-750bb0946dbd@daynix.com> To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Yanan Wang , John Snow , BALATON Zoltan , Jiaxun Yang , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , "Michael S. Tsirkin" , =?utf-8?q?Alex_Benn=C3=A9e?= , Peter Xu , Fabiano Rosas , Paolo Bonzini , David Hildenbrand , Thomas Huth , Laurent Vivier Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 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: none client-ip=2607:f8b0:4864:20::530; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x530.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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: 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 @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1719495697658100005 A test function may not be executed depending on the test command line so it is wrong to free data with a test function. Use qtest_add_data_func_full() to register a function to free data. Signed-off-by: Akihiko Odaki Reviewed-by: Thomas Huth --- tests/qtest/device-introspect-test.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index 5b0ffe43f5f4..587da59623dc 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -266,7 +266,6 @@ static void test_device_intro_concrete(const void *args) =20 qobject_unref(types); qtest_quit(qts); - g_free((void *)args); } =20 static void test_abstract_interfaces(void) @@ -310,12 +309,12 @@ static void add_machine_test_case(const char *mname) =20 path =3D g_strdup_printf("device/introspect/concrete/defaults/%s", mna= me); args =3D g_strdup_printf("-M %s", mname); - qtest_add_data_func(path, args, test_device_intro_concrete); + qtest_add_data_func_full(path, args, test_device_intro_concrete, g_fre= e); g_free(path); =20 path =3D g_strdup_printf("device/introspect/concrete/nodefaults/%s", m= name); args =3D g_strdup_printf("-nodefaults -M %s", mname); - qtest_add_data_func(path, args, test_device_intro_concrete); + qtest_add_data_func_full(path, args, test_device_intro_concrete, g_fre= e); g_free(path); } =20 @@ -330,7 +329,7 @@ int main(int argc, char **argv) qtest_add_func("device/introspect/abstract-interfaces", test_abstract_= interfaces); if (g_test_quick()) { qtest_add_data_func("device/introspect/concrete/defaults/none", - g_strdup(common_args), test_device_intro_concr= ete); + common_args, test_device_intro_concrete); } else { qtest_cb_for_every_machine(add_machine_test_case, true); } --=20 2.45.2