* [Qemu-devel] [PATCH] vhost-user: fix memory leak
@ 2018-02-13 2:53 linzhecheng
2018-02-13 3:53 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 4+ messages in thread
From: linzhecheng @ 2018-02-13 2:53 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, mst, wangxinxin.wang, lidonglin, linzhecheng
fix memory leak
Signed-off-by: linzhecheng <linzhecheng@huawei.com>
diff --git a/net/vhost-user.c b/net/vhost-user.c
index cb45512506..d024573e45 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -109,6 +109,7 @@ static int vhost_user_start(int queues, NetClientState *ncs[], CharBackend *be)
err:
if (net) {
vhost_net_cleanup(net);
+ g_free(net);
}
vhost_user_stop(i, ncs);
return -1;
--
2.12.2.windows.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] vhost-user: fix memory leak
2018-02-13 2:53 [Qemu-devel] [PATCH] vhost-user: fix memory leak linzhecheng
@ 2018-02-13 3:53 ` Philippe Mathieu-Daudé
2018-02-13 4:16 ` [Qemu-devel] 答复: " linzhecheng
0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-02-13 3:53 UTC (permalink / raw)
To: linzhecheng, qemu-devel; +Cc: pbonzini, wangxinxin.wang, lidonglin, mst
Hi Linzhecheng,
On 02/12/2018 11:53 PM, linzhecheng wrote:
> fix memory leak
>
> Signed-off-by: linzhecheng <linzhecheng@huawei.com>
>
> diff --git a/net/vhost-user.c b/net/vhost-user.c
> index cb45512506..d024573e45 100644
> --- a/net/vhost-user.c
> +++ b/net/vhost-user.c
> @@ -109,6 +109,7 @@ static int vhost_user_start(int queues, NetClientState *ncs[], CharBackend *be)
> err:
> if (net) {
> vhost_net_cleanup(net);
> + g_free(net);
I think this g_free() belongs to vhost_net_cleanup() in net/vhost_net.c:
void vhost_net_cleanup(struct vhost_net *net)
{
vhost_dev_cleanup(&net->dev);
g_free(net);
}
Regards,
Phil.
> }
> vhost_user_stop(i, ncs);
> return -1;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] 答复: [PATCH] vhost-user: fix memory leak
2018-02-13 3:53 ` Philippe Mathieu-Daudé
@ 2018-02-13 4:16 ` linzhecheng
2018-02-13 4:30 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 4+ messages in thread
From: linzhecheng @ 2018-02-13 4:16 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, wangxin (U), lidonglin, mst@redhat.com
> -----邮件原件-----
> 发件人: Philippe Mathieu-Daudé [mailto:philippe.mathieu.daude@gmail.com]
> 代表 Philippe Mathieu-Daudé
> 发送时间: 2018年2月13日 11:54
> 收件人: linzhecheng <linzhecheng@huawei.com>; qemu-devel@nongnu.org
> 抄送: pbonzini@redhat.com; wangxin (U) <wangxinxin.wang@huawei.com>;
> lidonglin <lidonglin@huawei.com>; mst@redhat.com
> 主题: Re: [Qemu-devel] [PATCH] vhost-user: fix memory leak
>
> Hi Linzhecheng,
>
> On 02/12/2018 11:53 PM, linzhecheng wrote:
> > fix memory leak
> >
> > Signed-off-by: linzhecheng <linzhecheng@huawei.com>
> >
> > diff --git a/net/vhost-user.c b/net/vhost-user.c index
> > cb45512506..d024573e45 100644
> > --- a/net/vhost-user.c
> > +++ b/net/vhost-user.c
> > @@ -109,6 +109,7 @@ static int vhost_user_start(int queues,
> > NetClientState *ncs[], CharBackend *be)
> > err:
> > if (net) {
> > vhost_net_cleanup(net);
> > + g_free(net);
>
> I think this g_free() belongs to vhost_net_cleanup() in net/vhost_net.c:
I think your qemu version is out of date, g_free was moved from vhost_net_cleanup in commit e6bcb1b
>
> void vhost_net_cleanup(struct vhost_net *net) {
> vhost_dev_cleanup(&net->dev);
> g_free(net);
> }
>
> Regards,
>
> Phil.
>
> > }
> > vhost_user_stop(i, ncs);
> > return -1;
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] 答复: [PATCH] vhost-user: fix memory leak
2018-02-13 4:16 ` [Qemu-devel] 答复: " linzhecheng
@ 2018-02-13 4:30 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-02-13 4:30 UTC (permalink / raw)
To: linzhecheng, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, wangxin (U), lidonglin, mst@redhat.com
On 02/13/2018 01:16 AM, linzhecheng wrote:
>> -----邮件原件-----
>> 发件人: Philippe Mathieu-Daudé [mailto:philippe.mathieu.daude@gmail.com]
>> 代表 Philippe Mathieu-Daudé
>> 发送时间: 2018年2月13日 11:54
>> 收件人: linzhecheng <linzhecheng@huawei.com>; qemu-devel@nongnu.org
>> 抄送: pbonzini@redhat.com; wangxin (U) <wangxinxin.wang@huawei.com>;
>> lidonglin <lidonglin@huawei.com>; mst@redhat.com
>> 主题: Re: [Qemu-devel] [PATCH] vhost-user: fix memory leak
>>
>> Hi Linzhecheng,
>>
>> On 02/12/2018 11:53 PM, linzhecheng wrote:
>>> fix memory leak
>>>
>>> Signed-off-by: linzhecheng <linzhecheng@huawei.com>
>>>
>>> diff --git a/net/vhost-user.c b/net/vhost-user.c index
>>> cb45512506..d024573e45 100644
>>> --- a/net/vhost-user.c
>>> +++ b/net/vhost-user.c
>>> @@ -109,6 +109,7 @@ static int vhost_user_start(int queues,
>>> NetClientState *ncs[], CharBackend *be)
>>> err:
>>> if (net) {
>>> vhost_net_cleanup(net);
>>> + g_free(net);
>>
>> I think this g_free() belongs to vhost_net_cleanup() in net/vhost_net.c:
> I think your qemu version is out of date, g_free was moved from vhost_net_cleanup in commit e6bcb1b
Now reading e6bcb1b I can understand your patch.
Can you add a reference to this commit in your patch description?
"g_free was moved from vhost_net_cleanup in commit e6bcb1b" might be enough.
Adding reference:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>
>> void vhost_net_cleanup(struct vhost_net *net) {
>> vhost_dev_cleanup(&net->dev);
>> g_free(net);
>> }
>>
>> Regards,
>>
>> Phil.
>>
>>> }
>>> vhost_user_stop(i, ncs);
>>> return -1;
>>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-13 4:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-13 2:53 [Qemu-devel] [PATCH] vhost-user: fix memory leak linzhecheng
2018-02-13 3:53 ` Philippe Mathieu-Daudé
2018-02-13 4:16 ` [Qemu-devel] 答复: " linzhecheng
2018-02-13 4:30 ` Philippe Mathieu-Daudé
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).