From: Marc-André Lureau Date: Mon, 6 Mar 2023 12:27:42 +0000 (+0400) Subject: char: do not double-close fd when failing to add client X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8467936e3df3484b4931576a72ae760a1610f022;p=qemu.git char: do not double-close fd when failing to add client The caller is already closing the fd on failure. Fixes: c3054a6e6a ("char: Factor out qmp_add_client() parts and move to chardev/") Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <20230306122751.2355515-3-marcandre.lureau@redhat.com> --- diff --git a/chardev/char.c b/chardev/char.c index 11eab7764c..e69390601f 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -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;