From: Alistair Francis Date: Thu, 30 Oct 2025 01:53:05 +0000 (+1000) Subject: hw/core/loader: Free the image file descriptor on error X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98d3546f01296af6b61b494b6e01bf0dc68039c0;p=thirdparty%2Fqemu.git hw/core/loader: Free the image file descriptor on error Coverity: CID 1642764 Fixes: f62226f7dc4 ("hw/core/loader: improve error handling in image loading functions") Signed-off-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Vishal Chourasia Message-ID: <20251030015306.2279148-2-alistair.francis@wdc.com> Signed-off-by: Alistair Francis --- diff --git a/hw/core/loader.c b/hw/core/loader.c index b7638ccd72..3d2c1ae286 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -86,6 +86,7 @@ int64_t get_image_size(const char *filename, Error **errp) if (size < 0) { error_setg_errno(errp, errno, "lseek failure: %s", filename); + close(fd); return -1; }