mirror of
https://github.com/xemu-project/xemu.git
synced 2026-07-11 01:24:41 +02:00
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:
committed by
Marc-André Lureau
parent
4be62d3117
commit
313f6884c8
+3
-1
@@ -94,7 +94,9 @@ static void qmp_chardev_open_file(Chardev *chr,
|
|||||||
|
|
||||||
if (!qemu_chr_open_fd(chr, in, out, errp)) {
|
if (!qemu_chr_open_fd(chr, in, out, errp)) {
|
||||||
qemu_close(out);
|
qemu_close(out);
|
||||||
qemu_close(in);
|
if (in >= 0) {
|
||||||
|
qemu_close(in);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user