Skip to content
Snippets Groups Projects
Commit 8467936e authored by Marc-André Lureau's avatar Marc-André Lureau
Browse files

char: do not double-close fd when failing to add client


The caller is already closing the fd on failure.

Fixes: c3054a6e ("char: Factor out qmp_add_client() parts and move to chardev/")
Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
Message-Id: <20230306122751.2355515-3-marcandre.lureau@redhat.com>
parent 6d3b418a
No related branches found
No related tags found
No related merge requests found
......@@ -1175,12 +1175,10 @@ bool qmp_add_client_char(int fd, bool has_skipauth, bool skipauth,
if (!s) {
error_setg(errp, "protocol '%s' is invalid", protocol);
close(fd);
return false;
}
if (qemu_chr_add_client(s, fd) < 0) {
error_setg(errp, "failed to add client");
close(fd);
return false;
}
return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment