From: Thomas Huth <thuth@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Chen Qun" <kuhn.chenqun@huawei.com>,
qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Cc: lvivier@redhat.com, peter.maydell@linaro.org,
zhang.zhanghailiang@huawei.com, hskinnemoen@google.com,
wuhaotsh@google.com, Euler Robot <euler.robot@huawei.com>
Subject: Re: [PATCH-for-5.2? 1/2] tests/qtest: variable defined by g_autofree need to be initialized
Date: Thu, 19 Nov 2020 08:55:05 +0100 [thread overview]
Message-ID: <5abd4a9c-d8bf-6918-26fa-7921f6c08195@redhat.com> (raw)
In-Reply-To: <cd63f998-e3fe-d93f-f515-a47103592e05@redhat.com>
On 18/11/2020 13.13, Philippe Mathieu-Daudé wrote:
> On 11/18/20 12:56 PM, Chen Qun wrote:
>> 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>
>> ---
>> tests/qtest/npcm7xx_timer-test.c | 8 +++-----
>> 1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/tests/qtest/npcm7xx_timer-test.c b/tests/qtest/npcm7xx_timer-test.c
>> index f08b0cd62a..83774a5b90 100644
>> --- a/tests/qtest/npcm7xx_timer-test.c
>> +++ b/tests/qtest/npcm7xx_timer-test.c
>> @@ -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)
>> {
>
> Or:
>
>> - g_autofree char *full_name;
> + g_autofree char *full_name = NULL;
I think we better go with the current version of the patch - otherwise a
supersmart new compiler version might warn again that the NULL that we
assign here is never used...
Reviewed-by: Thomas Huth <thuth@redhat.com>
next prev parent reply other threads:[~2020-11-19 7:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-18 11:56 [PATCH-for-5.2? 0/2] two qtest bugfix Chen Qun
2020-11-18 11:56 ` [PATCH-for-5.2? 1/2] tests/qtest: variable defined by g_autofree need to be initialized Chen Qun
2020-11-18 12:13 ` Philippe Mathieu-Daudé
2020-11-18 12:32 ` Chenqun (kuhn)
2020-11-19 7:55 ` Thomas Huth [this message]
2020-11-18 17:12 ` Havard Skinnemoen
2020-11-19 8:26 ` Peter Maydell
2020-11-19 8:35 ` Chenqun (kuhn)
2020-11-19 8:38 ` Peter Maydell
2020-11-19 11:22 ` Chenqun (kuhn)
2020-11-19 12:41 ` Chenqun (kuhn)
2020-11-18 11:56 ` [PATCH-for-5.2? 2/2] tests/qtest: fix memleak in npcm7xx_watchdog_timer-test Chen Qun
2020-11-18 17:14 ` Havard Skinnemoen
2020-11-18 17:22 ` Hao Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5abd4a9c-d8bf-6918-26fa-7921f6c08195@redhat.com \
--to=thuth@redhat.com \
--cc=euler.robot@huawei.com \
--cc=hskinnemoen@google.com \
--cc=kuhn.chenqun@huawei.com \
--cc=lvivier@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=wuhaotsh@google.com \
--cc=zhang.zhanghailiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).