When the qio_channel_socket_connect_sync() fails we should goto 'out' label to free the 'sioc' instead of return.
Reported-by: Euler Robot <euler.ro...@huawei.com> Signed-off-by: Alex Chen <alex.c...@huawei.com> --- qemu-nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index a7075c5419..47587a709e 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -181,7 +181,7 @@ static int qemu_nbd_client_list(SocketAddress *saddr, QCryptoTLSCreds *tls, sioc = qio_channel_socket_new(); if (qio_channel_socket_connect_sync(sioc, saddr, &err) < 0) { error_report_err(err); - return EXIT_FAILURE; + goto out; } rc = nbd_receive_export_list(QIO_CHANNEL(sioc), tls, hostname, &list, &err); -- 2.19.1