All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-nbd: Fix a memleak in nbd_client_thread()
@ 2020-12-01  6:13 ` Alex Chen
  0 siblings, 0 replies; 8+ messages in thread
From: Alex Chen @ 2020-12-01  6:13 UTC (permalink / raw)
  To: eblake; +Cc: alex.chen, qemu-devel, qemu-trivial, zhang.zhanghailiang,
	qemu-block

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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-03 16:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-01  6:13 [PATCH] qemu-nbd: Fix a memleak in nbd_client_thread() Alex Chen
2020-12-01  6:13 ` Alex Chen
2020-12-01 20:15 ` Eric Blake
2020-12-01 20:15   ` Eric Blake
2020-12-02  2:02   ` Alex Chen
2020-12-02  2:02     ` Alex Chen
2020-12-03 16:26     ` Eric Blake
2020-12-03 16:26       ` Eric Blake

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.