diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2014-04-24 13:58:18 +0200 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-04-25 11:41:41 -0400 |
commit | 0b9f0e2fd7c5070fa06cd6bd5ec69055e3a7d2b1 (patch) | |
tree | 3d5f3ed93d53a01abd31b164a4b9a714c46e07de /monitor.c | |
parent | 1b7a0f758bb3e49c8468fd2af75ebb215b26e6f4 (diff) |
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>
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 1 |
1 files changed, 1 insertions, 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; |