提交 0b9f0e2f 编写于 作者: S Stefan Hajnoczi 提交者: Luiz Capitulino

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: NStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 1b7a0f75
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册