Skip to content

Commit

Permalink
tests/qtest: variable defined by g_autofree need to be initialized
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Chen Qun <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Havard Skinnemoen <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
  • Loading branch information
Kuhn-Chen authored and huth committed Nov 20, 2020
1 parent 923e931 commit f369797
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tests/qtest/npcm7xx_timer-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit f369797

Please sign in to comment.