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, now the 'out' label is useless, delete it.
Reported-by: Euler Robot <euler.ro...@huawei.com> Signed-off-by: Alex Chen <alex.c...@huawei.com> --- qemu-nbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index 47587a709e..643b0777c0 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -275,7 +275,7 @@ static void *nbd_client_thread(void *arg) saddr, &local_error) < 0) { error_report_err(local_error); - goto out; + goto out_socket; } ret = nbd_receive_negotiate(NULL, QIO_CHANNEL(sioc), @@ -325,7 +325,6 @@ out_fd: close(fd); out_socket: object_unref(OBJECT(sioc)); -out: g_free(info.name); kill(getpid(), SIGTERM); return (void *) EXIT_FAILURE; -- 2.19.1