Skip to content

Commit

Permalink
qemu-nbd: Fix a memleak in qemu_nbd_client_list()
Browse files Browse the repository at this point in the history
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.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
Message-Id: <20201130123651.17543-1-alex.chen@huawei.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
  • Loading branch information
Alex Chen authored and ebblake committed Jan 20, 2021
1 parent 48202c7 commit 992809b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion qemu-nbd.c
Expand Up @@ -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);
Expand Down

0 comments on commit 992809b

Please sign in to comment.