[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/4] migration: Prevent memleak by ...params_test_apply
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [PATCH 1/4] migration: Prevent memleak by ...params_test_apply |
Date: |
Tue, 30 Jun 2020 11:28:20 +0100 |
User-agent: |
Mutt/1.14.3 (2020-06-14) |
* Max Reitz (mreitz@redhat.com) wrote:
> The created structure is not really a proper QAPI object, so we cannot
> and will not free its members. Strings therein should therefore not be
> duplicated, or we will leak them.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> migration/migration.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 481a590f72..47c7da4e55 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -1336,12 +1336,12 @@ static void
> migrate_params_test_apply(MigrateSetParameters *params,
>
> if (params->has_tls_creds) {
> assert(params->tls_creds->type == QTYPE_QSTRING);
> - dest->tls_creds = g_strdup(params->tls_creds->u.s);
> + dest->tls_creds = 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);
> + dest->tls_hostname = params->tls_hostname->u.s;
> }
Yeh I think I agree.
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
> if (params->has_max_bandwidth) {
> --
> 2.26.2
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK