qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Chuan Zheng <zhengchuan@huawei.com>
To: <quintela@redhat.com>, <dgilbert@redhat.com>, <berrange@redhat.com>
Cc: yubihong@huawei.com, zhang.zhanghailiang@huawei.com,
	qemu-devel@nongnu.org, xiexiangyou@huawei.com,
	alex.chen@huawei.com, wanghao232@huawei.com
Subject: [RESEND][PATCH] multifd/tls: fix memoryleak of the QIOChannelSocket object when canceling migration
Date: Wed, 11 Nov 2020 15:14:18 +0800	[thread overview]
Message-ID: <1605078858-114607-1-git-send-email-zhengchuan@huawei.com> (raw)

When creating new tls client, the tioc->master will be referenced, we need dereferenced
it after tls handshake.

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

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,
-- 
1.8.3.1



             reply	other threads:[~2020-11-11  7:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11  7:14 Chuan Zheng [this message]
2020-11-11  9:58 ` [RESEND][PATCH] multifd/tls: fix memoryleak of the QIOChannelSocket object when canceling migration Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1605078858-114607-1-git-send-email-zhengchuan@huawei.com \
    --to=zhengchuan@huawei.com \
    --cc=alex.chen@huawei.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=wanghao232@huawei.com \
    --cc=xiexiangyou@huawei.com \
    --cc=yubihong@huawei.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).