diff mbox series

multifd/tls: fix memoryleak of the QIOChannelSocket object when canceling migration

Message ID 1605078537-61763-1-git-send-email-zhengchuan@huawei.com (mailing list archive)
State New, archived
Headers show
Series multifd/tls: fix memoryleak of the QIOChannelSocket object when canceling migration | expand

Commit Message

Zheng Chuan Nov. 11, 2020, 7:08 a.m. UTC
When creating new tls client, the tioc->master will be referred, we need unrefer
it after tls handshake.

Signed-off-by: Chuan Zheng <zhengchuan@huawei.com>
---
 migration/multifd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/migration/multifd.c b/migration/multifd.c
index 68b171f..df76a8e 100644
--- a/migration/multifd.c
+++ b/migration/multifd.c
@@ -728,7 +728,8 @@  static void multifd_tls_outgoing_handshake(QIOTask *task,
                                            gpointer opaque)
 {
     MultiFDSendParams *p = opaque;
-    QIOChannel *ioc = QIO_CHANNEL(qio_task_get_source(task));
+    QIOChannelTLS *tioc = QIO_CHANNEL_TLS(qio_task_get_source(task));
+    QIOChannel *ioc = QIO_CHANNEL(tioc);
     Error *err = NULL;
 
     if (qio_task_propagate_error(task, &err)) {
@@ -737,6 +738,7 @@  static void multifd_tls_outgoing_handshake(QIOTask *task,
         trace_multifd_tls_outgoing_handshake_complete(ioc);
     }
     multifd_channel_connect(p, ioc, err);
+    object_unref(OBJECT(tioc->master));
 }
 
 static void multifd_tls_channel_connect(MultiFDSendParams *p,