summary refs log tree commit diff stats
path: root/dump/dump.c
diff options
context:
space:
mode:
authorZongmin Zhou <min_halo@163.com>2023-11-07 10:44:17 +0800
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2023-11-07 13:08:49 +0100
commit95a40c44501b5e3b8d1922ea37f30142981b2b34 (patch)
treeef771667e21784e54e23824a9e6587c8776f696c /dump/dump.c
parent547ec5a0a4f697323e313062fabdebefc964eb97 (diff)
downloadfocaccia-qemu-95a40c44501b5e3b8d1922ea37f30142981b2b34.tar.gz
focaccia-qemu-95a40c44501b5e3b8d1922ea37f30142981b2b34.zip
dump: Add close fd on error return to avoid resource leak
Reported-by: Coverity CID 1523842 (RESOURCE_LEAK)
Fixes: e6549197f7 ("dump: Add command interface for kdump-raw formats")
Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20231107024417.585475-1-min_halo@163.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'dump/dump.c')
-rw-r--r--dump/dump.c1
1 files changed, 1 insertions, 0 deletions
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;
     }