Skip to content

Commit

Permalink
dump: Add close fd on error return to avoid resource leak
Browse files Browse the repository at this point in the history
Reported-by: Coverity CID 1523842 (RESOURCE_LEAK)
Fixes: e654919 ("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>
  • Loading branch information
zhouzongmin authored and philmd committed Nov 7, 2023
1 parent 547ec5a commit 95a40c4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions dump/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 95a40c4

Please sign in to comment.