hw/cxl: cdat: Fix open file not closed in ct3_load_cdat()
commit71ba92f3488b64bd5c81e2872c56e88cea21bb95
authorHao Zeng <zenghao@kylinos.cn>
Fri, 21 Apr 2023 13:20:19 +0000 (21 14:20 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 19 May 2023 05:36:09 +0000 (19 01:36 -0400)
tree517399b4ebe17dd377c8d7b68abbab99be8fcb9a
parent5d410557dea452f6231a7c66155e29a37e168528
hw/cxl: cdat: Fix open file not closed in ct3_load_cdat()

Open file descriptor not closed in error paths. Fix by replace
open coded handling of read of whole file into a buffer with
g_file_get_contents()

Fixes: aba578bdac ("hw/cxl: CDAT Data Object Exchange implementation")
Signed-off-by: Zeng Hao <zenghao@kylinos.cn>
Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Suggested-by: Jonathan Cameron via <qemu-devel@nongnu.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
--
Changes since v5:
- Drop if guard on g_free() as per checkpatch warning.
Message-Id: <20230421132020.7408-2-Jonathan.Cameron@huawei.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/cxl/cxl-cdat.c