chardev/char-file: fix failure path
'in' will be -1 when file->in is unset. Let's not try to close
invalid fd.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Coverity: CID 1630444
Fixes: 69620c091d "chardev: qemu_chr_open_fd(): add errp"
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20251014145029.949285-1-vsementsov@yandex-team.ru>
This commit is contained in:
parent
4be62d3117
commit
313f6884c8
1 changed files with 3 additions and 1 deletions
|
|
@ -94,7 +94,9 @@ static void qmp_chardev_open_file(Chardev *chr,
|
|||
|
||||
if (!qemu_chr_open_fd(chr, in, out, errp)) {
|
||||
qemu_close(out);
|
||||
qemu_close(in);
|
||||
if (in >= 0) {
|
||||
qemu_close(in);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue