mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-10 10:59:28 -07:00
monitor: fix qmp_getfd() fd leak in error case
qemu_chr_fe_get_msgfd() transfers ownership of the file descriptor to the caller. Therefore all code paths in qmp_getfd() should either register the file descriptor somewhere or close it. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
1b7a0f758b
commit
0b9f0e2fd7
1 changed files with 1 additions and 0 deletions
|
|
@ -2228,6 +2228,7 @@ void qmp_getfd(const char *fdname, Error **errp)
|
|||
}
|
||||
|
||||
if (qemu_isdigit(fdname[0])) {
|
||||
close(fd);
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdname",
|
||||
"a name not starting with a digit");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue