qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Zongmin Zhou <min_halo@163.com>,
	marcandre.lureau@redhat.com, qemu-devel@nongnu.org,
	Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Zongmin Zhou <zhouzongmin@kylinos.cn>
Subject: Re: [PATCH] dump:Add close fd on error return to avoid resource leak
Date: Tue, 7 Nov 2023 09:55:57 +0100	[thread overview]
Message-ID: <16217b00-d400-4ec0-a544-8b02c8e5839b@linaro.org> (raw)
In-Reply-To: <20231107024417.585475-1-min_halo@163.com>

On 7/11/23 03:44, Zongmin Zhou wrote:
> Signed-off-by: Zongmin Zhou<zhouzongmin@kylinos.cn>

Reported-by: Coverity CID 1523842 (RESOURCE_LEAK)
Fixes: e6549197f7 ("dump: Add command interface for kdump-raw formats")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> ---
>   dump/dump.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/dump/dump.c b/dump/dump.c
> index 1c304cadfd..ad5294e853 100644
> --- a/dump/dump.c
> +++ b/dump/dump.c
> @@ -2160,6 +2160,7 @@ void qmp_dump_guest_memory(bool paging, const char *protocol,
>           return;
>       }
>       if (kdump_raw && lseek(fd, 0, SEEK_CUR) == (off_t) -1) {
> +        close(fd);
>           error_setg(errp, "kdump-raw formats require a seekable file");
>           return;
>       }



  parent reply	other threads:[~2023-11-07  8:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07  2:44 [PATCH] dump:Add close fd on error return to avoid resource leak Zongmin Zhou
2023-11-07  6:15 ` Marc-André Lureau
2023-11-07  8:55 ` Philippe Mathieu-Daudé [this message]
2023-11-07 11:48 ` Philippe Mathieu-Daudé
2023-11-07 11:54   ` Marc-André Lureau

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=16217b00-d400-4ec0-a544-8b02c8e5839b@linaro.org \
    --to=philmd@linaro.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=min_halo@163.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stephen.s.brennan@oracle.com \
    --cc=zhouzongmin@kylinos.cn \
    /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).