qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Shannon Zhao <zhaoshenglong@huawei.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, hangaohuai@huawei.com,
	zhang.zhanghailiang@huawei.com, qemu-trivial@nongnu.org,
	mjt@tls.msk.ru, mdroth@linux.vnet.ibm.com,
	peter.huangpeng@huawei.com, shannon.zhao@linaro.org,
	pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] qga/commands-posix: Fix resource leak
Date: Sat, 14 Mar 2015 10:56:09 +0100	[thread overview]
Message-ID: <550405B9.4010604@weilnetz.de> (raw)
In-Reply-To: <1426326735-11448-1-git-send-email-zhaoshenglong@huawei.com>

Am 14.03.2015 um 10:52 schrieb Shannon Zhao:
> It's detected by coverity. Close the dirfd.
>
> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
>      v1->v2: close after use [Stefan Weil]
> ---
>   qga/commands-posix.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index d5bb5cb..ba8de62 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -2283,6 +2283,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
>   
>       buf = g_malloc0(20);
>       ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
> +    close(dirfd);
>       if (local_err) {
>           g_free(buf);
>           error_propagate(errp, local_err);

Thanks.

Reviewed-by: Stefan Weil <sw@weilnetz.de>

  reply	other threads:[~2015-03-14  9:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-14  9:52 [Qemu-devel] [PATCH v2] qga/commands-posix: Fix resource leak Shannon Zhao
2015-03-14  9:56 ` Stefan Weil [this message]
2015-03-16  4:17   ` Shannon Zhao
2015-03-16  1:27 ` zhanghailiang
2015-03-16  4:18   ` Shannon Zhao
2015-03-19  8:40 ` Michael Tokarev

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=550405B9.4010604@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=hangaohuai@huawei.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=shannon.zhao@linaro.org \
    --cc=zhang.zhanghailiang@huawei.com \
    --cc=zhaoshenglong@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).