* [PATCH 1/1] /net/tap.c: Fix a memory leak
@ 2020-11-22 4:44 ruc_gongyuanjun
2020-11-22 11:39 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: ruc_gongyuanjun @ 2020-11-22 4:44 UTC (permalink / raw)
To: qemu-devel; +Cc: yuanjungong
From: yuanjungong <ruc_gongyuanjun@163.com>
Close fd before returning.
Buglink: https://bugs.launchpad.net/qemu/+bug/1904486
Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com>
---
net/tap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/tap.c b/net/tap.c
index c46ff66..fe95fa7 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -817,6 +817,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
if (ret < 0) {
error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d",
name, fd);
+ close(fd);
return -1;
}
@@ -831,6 +832,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
vhostfdname, vnet_hdr, fd, &err);
if (err) {
error_propagate(errp, err);
+ close(fd);
return -1;
}
} else if (tap->has_fds) {
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] /net/tap.c: Fix a memory leak
2020-11-22 4:44 [PATCH 1/1] /net/tap.c: Fix a memory leak ruc_gongyuanjun
@ 2020-11-22 11:39 ` Peter Maydell
2020-11-23 2:51 ` Jason Wang
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2020-11-22 11:39 UTC (permalink / raw)
To: ruc_gongyuanjun; +Cc: Jason Wang, QEMU Developers
On Sun, 22 Nov 2020 at 11:07, <ruc_gongyuanjun@163.com> wrote:
>
> From: yuanjungong <ruc_gongyuanjun@163.com>
>
> Close fd before returning.
>
> Buglink: https://bugs.launchpad.net/qemu/+bug/1904486
> Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com>
> ---
> net/tap.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/tap.c b/net/tap.c
> index c46ff66..fe95fa7 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -817,6 +817,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
> if (ret < 0) {
> error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d",
> name, fd);
> + close(fd);
> return -1;
> }
>
> @@ -831,6 +832,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
> vhostfdname, vnet_hdr, fd, &err);
> if (err) {
> error_propagate(errp, err);
> + close(fd);
> return -1;
> }
> } else if (tap->has_fds) {
> --
> 2.17.1
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] /net/tap.c: Fix a memory leak
2020-11-22 11:39 ` Peter Maydell
@ 2020-11-23 2:51 ` Jason Wang
0 siblings, 0 replies; 3+ messages in thread
From: Jason Wang @ 2020-11-23 2:51 UTC (permalink / raw)
To: Peter Maydell, ruc_gongyuanjun; +Cc: QEMU Developers
On 2020/11/22 下午7:39, Peter Maydell wrote:
> On Sun, 22 Nov 2020 at 11:07, <ruc_gongyuanjun@163.com> wrote:
>> From: yuanjungong <ruc_gongyuanjun@163.com>
>>
>> Close fd before returning.
>>
>> Buglink: https://bugs.launchpad.net/qemu/+bug/1904486
>> Signed-off-by: yuanjungong <ruc_gongyuanjun@163.com>
>> ---
>> net/tap.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/net/tap.c b/net/tap.c
>> index c46ff66..fe95fa7 100644
>> --- a/net/tap.c
>> +++ b/net/tap.c
>> @@ -817,6 +817,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
>> if (ret < 0) {
>> error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d",
>> name, fd);
>> + close(fd);
>> return -1;
>> }
>>
>> @@ -831,6 +832,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
>> vhostfdname, vnet_hdr, fd, &err);
>> if (err) {
>> error_propagate(errp, err);
>> + close(fd);
>> return -1;
>> }
>> } else if (tap->has_fds) {
>> --
>> 2.17.1
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> thanks
> -- PMM
Applied.
Thanks
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-23 2:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-22 4:44 [PATCH 1/1] /net/tap.c: Fix a memory leak ruc_gongyuanjun
2020-11-22 11:39 ` Peter Maydell
2020-11-23 2:51 ` Jason Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.