[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 6/7] block/curl: fix minor memory leaks
From: |
Richard W.M. Jones |
Subject: |
Re: [Qemu-devel] [PATCH v3 6/7] block/curl: fix minor memory leaks |
Date: |
Wed, 8 Nov 2017 11:45:00 +0000 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
On Tue, Nov 07, 2017 at 05:27:23PM -0500, Jeff Cody wrote:
> Signed-off-by: Jeff Cody <address@hidden>
> ---
> block/curl.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/block/curl.c b/block/curl.c
> index 00a9879..35cf417 100644
> --- a/block/curl.c
> +++ b/block/curl.c
> @@ -857,6 +857,9 @@ out_noclean:
> qemu_mutex_destroy(&s->mutex);
> g_free(s->cookie);
> g_free(s->url);
> + g_free(s->username);
> + g_free(s->proxyusername);
> + g_free(s->proxypassword);
> qemu_opts_del(opts);
> return -EINVAL;
> }
> @@ -955,6 +958,9 @@ static void curl_close(BlockDriverState *bs)
>
> g_free(s->cookie);
> g_free(s->url);
> + g_free(s->username);
> + g_free(s->proxyusername);
> + g_free(s->proxypassword);
username & proxyusername are allocated with g_strdup and so
should obviously be freed.
proxypassword is returned by qcrypto_secret_lookup_as_utf8, and it's
not clear to me if we should free that or not. However examining the
code of qcrypto_secret_lookup it looks as if this string is allocated
by g_new0, which would indicate that it should also be freed.
Therefore:
Reviewed-by: Richard W.M. Jones <address@hidden>
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
[Qemu-devel] [PATCH v3 6/7] block/curl: fix minor memory leaks, Jeff Cody, 2017/11/07
[Qemu-devel] [PATCH v3 5/7] block/curl: check error return of curl_global_init(), Jeff Cody, 2017/11/07