tests/qtest: variable defined by g_autofree need to be initialized

According to the glib function requirements, we need initialise
 the variable. Otherwise there will be compilation warnings:

glib-autocleanups.h:28:3: warning: ‘full_name’ may be
used uninitialized in this function [-Wmaybe-uninitialized]
   28 |   g_free (*pp);
      |   ^~~~~~~~~~~~

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Havard Skinnemoen <hskinnemoen@google.com>
Message-Id: <20201118115646.2461726-2-kuhn.chenqun@huawei.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Chen Qun 2020-11-18 19:56:45 +08:00 committed by Thomas Huth
parent 923e931188
commit f369797617
1 changed files with 3 additions and 5 deletions

View File

@ -512,11 +512,9 @@ static void test_disable_on_expiration(gconstpointer test_data)
*/
static void tim_add_test(const char *name, const TestData *td, GTestDataFunc fn)
{
g_autofree char *full_name;
full_name = g_strdup_printf("npcm7xx_timer/tim[%d]/timer[%d]/%s",
tim_index(td->tim), timer_index(td->timer),
name);
g_autofree char *full_name = g_strdup_printf(
"npcm7xx_timer/tim[%d]/timer[%d]/%s", tim_index(td->tim),
timer_index(td->timer), name);
qtest_add_data_func(full_name, td, fn);
}