qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests/plugin: prevent uninitialized warning


From: Alex Bennée
Subject: Re: [PATCH] tests/plugin: prevent uninitialized warning
Date: Thu, 06 Feb 2020 16:22:15 +0000
User-agent: mu4e 1.3.7; emacs 27.0.60

Chenqun (kuhn) <address@hidden> writes:

>>-----Original Message-----
>>From: Alex Bennée [mailto:address@hidden]
>>Sent: Thursday, February 6, 2020 8:46 PM
>>To: Chenqun (kuhn) <address@hidden>
>>Cc: address@hidden; Zhanghailiang
>><address@hidden>; address@hidden;
>>address@hidden
>>Subject: Re: [PATCH] tests/plugin: prevent uninitialized warning
>>
>>
>>address@hidden writes:
>>
>>> From: Chen Qun <address@hidden>
>>>
>>> According to the glibc function requirements, we need initialise  the
>>> variable. Otherwise there will be compilation warnings:
>>>
>>> glib-autocleanups.h:28:3: warning: ‘out’ may be used uninitialized in
>>> this function [-Wmaybe-uninitialized]
>>>    g_free (*pp);
>>>    ^~~~~~~~~~~~
>>>
>>> Reported-by: Euler Robot <address@hidden>
>>> Signed-off-by: Chen Qun <address@hidden>
>>
>>Queued to plugins/next with Thomas' single line suggestion, thanks.
>
> Thank you!
> By the way,  what is plugins/next connection address?

My tree is on github:

  https://github.com/stsquad/qemu/tree/plugins/next

>
>>
>>> ---
>>>  tests/plugin/bb.c   | 2 +-
>>>  tests/plugin/insn.c | 2 +-
>>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c index
>>> f30bea08dc..8b9da23a04 100644
>>> --- a/tests/plugin/bb.c
>>> +++ b/tests/plugin/bb.c
>>> @@ -22,7 +22,7 @@ static bool do_inline;
>>>
>>>  static void plugin_exit(qemu_plugin_id_t id, void *p)  {
>>> -    g_autofree gchar *out;
>>> +    g_autofree gchar *out = NULL;
>>>      out = g_strdup_printf("bb's: %" PRIu64", insns: %" PRIu64 "\n",
>>>                            bb_count, insn_count);
>>>      qemu_plugin_outs(out);
>>> diff --git a/tests/plugin/insn.c b/tests/plugin/insn.c index
>>> 0a8f5a0000..c83b1c0157 100644
>>> --- a/tests/plugin/insn.c
>>> +++ b/tests/plugin/insn.c
>>> @@ -44,7 +44,7 @@ static void vcpu_tb_trans(qemu_plugin_id_t id,
>>> struct qemu_plugin_tb *tb)
>>>
>>>  static void plugin_exit(qemu_plugin_id_t id, void *p)  {
>>> -    g_autofree gchar *out;
>>> +    g_autofree gchar *out = NULL;
>>>      out = g_strdup_printf("insns: %" PRIu64 "\n", insn_count);
>>>      qemu_plugin_outs(out);
>>>  }
>>
>>
>>--
>>Alex Bennée


-- 
Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]