]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qemu-nbd: Fix a memleak in qemu_nbd_client_list()
authorAlex Chen <alex.chen@huawei.com>
Mon, 30 Nov 2020 12:36:51 +0000 (12:36 +0000)
committerEric Blake <eblake@redhat.com>
Wed, 20 Jan 2021 20:48:05 +0000 (14:48 -0600)
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>
qemu-nbd.c

index a7075c5419d710d773a5c5ed749f9e75f32c4aed..47587a709e6bf408399e7517217b5b68e2d2f4c1 100644 (file)
@@ -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);