From: Pan Nengyuan <pannengyuan@huawei.com>
To: "Laurent Vivier" <laurent@vivier.eu>,
"Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: "Daniel P. Berrange" <berrange@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
qemu trival <qemu-trivial@nongnu.org>,
QEMU <qemu-devel@nongnu.org>,
Euler Robot <euler.robot@huawei.com>,
Paolo Bonzini <pbonzini@redhat.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>
Subject: Re: [PATCH] core/qdev: fix memleak in qdev_get_gpio_out_connector()
Date: Mon, 9 Mar 2020 18:41:00 +0800 [thread overview]
Message-ID: <a69e324c-21c4-dcfd-516d-0515f86a2f28@huawei.com> (raw)
In-Reply-To: <87b027ab-7bed-249a-08a2-2c27fdd05a31@vivier.eu>
On 3/9/2020 5:16 PM, Laurent Vivier wrote:
> Le 07/03/2020 à 11:39, Marc-André Lureau a écrit :
>> Hi
>>
>> On Sat, Mar 7, 2020 at 3:53 AM Pan Nengyuan <pannengyuan@huawei.com> wrote:
>>>
>>> Fix a memory leak in qdev_get_gpio_out_connector().
>>>
>>> Reported-by: Euler Robot <euler.robot@huawei.com>
>>> Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
>>
>> good catch,
>> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> trivial question:
>
> Why do we prefer g_autofree() to the g_free() function?
Honestly, it's no special reason in this case, just personal preference. :)
Both of them is ok.
Thanks.
>
> Thanks,
> Laurent
>
>>> ---
>>> hw/core/qdev.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
>>> index 3937d1eb1a..85f062def7 100644
>>> --- a/hw/core/qdev.c
>>> +++ b/hw/core/qdev.c
>>> @@ -557,7 +557,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
>>>
>>> qemu_irq qdev_get_gpio_out_connector(DeviceState *dev, const char *name, int n)
>>> {
>>> - char *propname = g_strdup_printf("%s[%d]",
>>> + g_autofree char *propname = g_strdup_printf("%s[%d]",
>>> name ? name : "unnamed-gpio-out", n);
>>>
>>> qemu_irq ret = (qemu_irq)object_property_get_link(OBJECT(dev), propname,
>>> --
>>> 2.18.2
>>>
>>>
>>
>>
>
next prev parent reply other threads:[~2020-03-09 10:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-07 3:07 [PATCH] core/qdev: fix memleak in qdev_get_gpio_out_connector() Pan Nengyuan
2020-03-07 3:16 ` no-reply
2020-03-07 10:39 ` Marc-André Lureau
2020-03-09 9:16 ` Laurent Vivier
2020-03-09 10:41 ` Pan Nengyuan [this message]
2020-03-09 10:49 ` Laurent Vivier
2020-03-09 10:48 ` Daniel P. Berrangé
2020-03-09 12:05 ` Laurent Vivier
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=a69e324c-21c4-dcfd-516d-0515f86a2f28@huawei.com \
--to=pannengyuan@huawei.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=euler.robot@huawei.com \
--cc=laurent@vivier.eu \
--cc=marcandre.lureau@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--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).