[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] qemu-nbd: Fix a memleak in nbd_client_thread()
From: |
Alex Chen |
Subject: |
[PATCH] qemu-nbd: Fix a memleak in nbd_client_thread() |
Date: |
Tue, 1 Dec 2020 06:13:49 +0000 |
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.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@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
- [PATCH] qemu-nbd: Fix a memleak in nbd_client_thread(),
Alex Chen <=