io: Fix qio_channel_socket_close() error handling
commitfdceb4ab4d7ba920bb094ab477df4221261b291e
authorMarkus Armbruster <armbru@redhat.com>
Wed, 22 Apr 2020 13:07:15 +0000 (22 15:07 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Wed, 29 Apr 2020 06:01:52 +0000 (29 08:01 +0200)
tree0d67a3ee99a237cb76da2f7de530eab8af01d205
parentc61d1d9e4976d127a73bec14376d8e828491f62c
io: Fix qio_channel_socket_close() error handling

The Error ** argument must be NULL, &error_abort, &error_fatal, or a
pointer to a variable containing NULL.  Passing an argument of the
latter kind twice without clearing it in between is wrong: if the
first call sets an error, it no longer points to NULL for the second
call.

qio_channel_socket_close() passes @errp first to
socket_listen_cleanup(), and then, if closesocket() fails, to
error_setg_errno().  If socket_listen_cleanup() failed, this will trip
the assertion in error_setv().

Fix by ignoring a second error.

Fixes: 73564c407caedf992a1c688b5fea776a8b56ba2a
Cc: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200422130719.28225-11-armbru@redhat.com>
io/channel-socket.c