From: Jason Wang <jasowang@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, ruc_gongyuanjun@163.com
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH 1/1] /net/tap.c: Fix a memory leak
Date: Mon, 23 Nov 2020 10:51:37 +0800 [thread overview]
Message-ID: <a66e14c4-1765-901d-c3aa-e6eaefad7c0a@redhat.com> (raw)
In-Reply-To: <CAFEAcA-Oc1JO-3H+mmjmhTuVLa89fMN8HgWHhnO8q5TpBg61MA@mail.gmail.com>
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
>
prev parent reply other threads:[~2020-11-23 2:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=a66e14c4-1765-901d-c3aa-e6eaefad7c0a@redhat.com \
--to=jasowang@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=ruc_gongyuanjun@163.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).