[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Subject:[PATCH] cxl-cdat:Fix open file not closed in ct3_loa
From: |
Fan Ni |
Subject: |
Re: [PATCH] Subject:[PATCH] cxl-cdat:Fix open file not closed in ct3_load_cdat |
Date: |
Mon, 3 Apr 2023 16:31:04 +0000 |
On Mon, Apr 03, 2023 at 04:42:45PM +0800, zenghao wrote:
> 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;
> }
>
Good catch.
Reviewed-by: Fan Ni <fan.ni@samsung.com>
> --
> 2.37.2
>
>
> No virus found
> Checked by Hillstone Network AntiVirus