qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: guangrong.xiao@gmail.com
To: pbonzini@redhat.com, mst@redhat.com, mtosatti@redhat.com
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, dgilbert@redhat.com,
	peterx@redhat.com, wei.w.wang@intel.com, eblake@redhat.com,
	quintela@redhat.com, cota@braap.org,
	Xiao Guangrong <xiaoguangrong@tencent.com>
Subject: [Qemu-devel] [PATCH v2 2/3] migration: fix memory leak when updating tls-creds and tls-hostname
Date: Fri, 11 Jan 2019 14:37:31 +0800	[thread overview]
Message-ID: <20190111063732.10484-3-xiaoguangrong@tencent.com> (raw)
In-Reply-To: <20190111063732.10484-1-xiaoguangrong@tencent.com>

From: Xiao Guangrong <xiaoguangrong@tencent.com>

If we update parameter, tls-creds and tls-hostname, these string
values are duplicated to local variables in migrate_params_test_apply()
by using g_strdup(), however these new allocated memory are missed to
be freed

Actually, they are not used to check anything, we can directly skip
them

Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
---
 migration/migration.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index a82d594f29..fb39d7bec1 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1145,16 +1145,6 @@ static void migrate_params_test_apply(MigrateSetParameters *params,
         dest->cpu_throttle_increment = params->cpu_throttle_increment;
     }
 
-    if (params->has_tls_creds) {
-        assert(params->tls_creds->type == QTYPE_QSTRING);
-        dest->tls_creds = g_strdup(params->tls_creds->u.s);
-    }
-
-    if (params->has_tls_hostname) {
-        assert(params->tls_hostname->type == QTYPE_QSTRING);
-        dest->tls_hostname = g_strdup(params->tls_hostname->u.s);
-    }
-
     if (params->has_max_bandwidth) {
         dest->max_bandwidth = params->max_bandwidth;
     }
-- 
2.14.5

  parent reply	other threads:[~2019-01-11  6:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11  6:37 [Qemu-devel] [PATCH v2 0/3] optimize waiting for free thread to do compression guangrong.xiao
2019-01-11  6:37 ` [Qemu-devel] [PATCH v2 1/3] migration: introduce pages-per-second guangrong.xiao
2019-01-11 15:37   ` Eric Blake
2019-01-23 12:51     ` Dr. David Alan Gilbert
2019-01-23 12:34   ` Dr. David Alan Gilbert
2019-01-11  6:37 ` guangrong.xiao [this message]
2019-01-15  7:51   ` [Qemu-devel] [PATCH v2 2/3] migration: fix memory leak when updating tls-creds and tls-hostname Peter Xu
2019-01-15 10:24     ` Dr. David Alan Gilbert
2019-01-15 16:03       ` Eric Blake
2019-01-16  5:55         ` Peter Xu
2019-02-18  8:26         ` Xiao Guangrong
2019-01-11  6:37 ` [Qemu-devel] [PATCH v2 3/3] migration: introduce adaptive model for waiting thread guangrong.xiao
2019-01-11  9:57   ` Markus Armbruster
2019-02-18  8:47     ` Xiao Guangrong
2019-01-16  6:40   ` Peter Xu
2019-02-18  9:01     ` Xiao Guangrong
2019-01-11  9:53 ` [Qemu-devel] [PATCH v2 0/3] optimize waiting for free thread to do compression Markus Armbruster
2019-01-13 14:43 ` no-reply
2019-01-13 17:41 ` no-reply

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=20190111063732.10484-3-xiaoguangrong@tencent.com \
    --to=guangrong.xiao@gmail.com \
    --cc=cota@braap.org \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=wei.w.wang@intel.com \
    --cc=xiaoguangrong@tencent.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).