qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hao Zeng <zenghao@kylinos.cn>
To: jonathan.cameron@huawei.com, fan.ni@samsung.com,
	peter.maydell@linaro.org, qemu-devel@nongnu.org
Cc: Hao Zeng <zenghao@kylinos.cn>, Xie Ming <xieming@kylinos.cn>
Subject: [PATCH v2 1/2] cxl-cdat:Fix open file not closed in ct3_load_cdat
Date: Wed, 12 Apr 2023 15:16:32 +0800	[thread overview]
Message-ID: <20230412071633.2660412-2-zenghao@kylinos.cn> (raw)
In-Reply-To: <20230412071633.2660412-1-zenghao@kylinos.cn>

opened file processor not closed,May cause file processor leaks
Fixes:aba578bdace5303a441f8a37aad781b5cb06f38c

Signed-off-by: Zeng Hao <zenghao@kylinos.cn>
Suggested-by: Xie Ming <xieming@kylinos.cn>
---
 hw/cxl/cxl-cdat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/cxl/cxl-cdat.c b/hw/cxl/cxl-cdat.c
index 137abd0992..ba7ed1aafd 100644
--- a/hw/cxl/cxl-cdat.c
+++ b/hw/cxl/cxl-cdat.c
@@ -128,6 +128,7 @@ static void ct3_load_cdat(CDATObject *cdat, Error **errp)
 
     if (fread(cdat->buf, file_size, 1, fp) == 0) {
         error_setg(errp, "CDAT: File read failed");
+        fclose(fp);
         return;
     }
 
-- 
2.37.2


No virus found
		Checked by Hillstone Network AntiVirus


  reply	other threads:[~2023-04-12  7:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12  7:16 [PATCH v2 0/2] cxl-cdat:Fix two problems of ct3_load_cdat Hao Zeng
2023-04-12  7:16 ` Hao Zeng [this message]
2023-04-12  9:58   ` [PATCH v2 1/2] cxl-cdat:Fix open file not closed in ct3_load_cdat Philippe Mathieu-Daudé
2023-04-12  7:16 ` [PATCH v2 2/2] cxl-cdat:Fix the check on the return value of fread() Hao Zeng
2023-04-12 10:02   ` Philippe Mathieu-Daudé
2023-04-12 13:02     ` Jonathan Cameron via

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=20230412071633.2660412-2-zenghao@kylinos.cn \
    --to=zenghao@kylinos.cn \
    --cc=fan.ni@samsung.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=xieming@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).