qemu-nbd: Fix a memleak in nbd_client_thread()
commitaf74b550bd8ee02c0fdeaa595d5e6f677969f39b
authorAlex Chen <alex.chen@huawei.com>
Tue, 8 Dec 2020 13:49:44 +0000 (8 13:49 +0000)
committerEric Blake <eblake@redhat.com>
Wed, 20 Jan 2021 20:48:05 +0000 (20 14:48 -0600)
tree30a9068ccd64d621ffe94ffa425061352cf9218c
parent992809bf8bfa4a6ba0765344fb11d41ae7db3280
qemu-nbd: Fix a memleak in nbd_client_thread()

When the qio_channel_socket_connect_sync() fails
we should goto 'out_socket' label to free the 'sioc' instead of
goto 'out' label.
In addition, there's a lot of redundant code in the successful branch
and the error branch, optimize it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20201208134944.27962-1-alex.chen@huawei.com>
qemu-nbd.c