qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] websock: fix handshake leak
@ 2018-10-19 10:13 Marc-André Lureau
  2018-10-19 10:26 ` Daniel P. Berrangé
  2018-10-19 12:07 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Marc-André Lureau @ 2018-10-19 10:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: berrange, jusual, Marc-André Lureau

Thanks Valgrind:

==955== 217 bytes in 1 blocks are definitely lost in loss record 275 of 321
==955==    at 0x483A965: realloc (vg_replace_malloc.c:785)
==955==    by 0x50B6839: __vasprintf_chk (in /usr/lib64/libc-2.28.so)
==955==    by 0x49AA05C: g_vasprintf (in /usr/lib64/libglib-2.0.so.0.5800.1)
==955==    by 0x4983440: g_strdup_vprintf (in /usr/lib64/libglib-2.0.so.0.5800.1)
==955==    by 0x126048: qio_channel_websock_handshake_send_res (channel-websock.c:162)
==955==    by 0x1266E6: qio_channel_websock_handshake_send_res_ok (channel-websock.c:362)
==955==    by 0x126D3E: qio_channel_websock_handshake_process (channel-websock.c:468)
==955==    by 0x126EF2: qio_channel_websock_handshake_read (channel-websock.c:511)
==955==    by 0x12715B: qio_channel_websock_handshake_io (channel-websock.c:571)
==955==    by 0x125027: qio_channel_fd_source_dispatch (channel-watch.c:84)
==955==    by 0x496326C: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.5800.1)
==955==    by 0x169EC3: glib_pollfds_poll (main-loop.c:215)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 io/channel-websock.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/io/channel-websock.c b/io/channel-websock.c
index e6608b969d..dc43dc6bb9 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -163,6 +163,7 @@ qio_channel_websock_handshake_send_res(QIOChannelWebsock *ioc,
     responselen = strlen(response);
     buffer_reserve(&ioc->encoutput, responselen);
     buffer_append(&ioc->encoutput, response, responselen);
+    g_free(response);
     va_end(vargs);
 }
 
-- 
2.19.0.271.gfe8321ec05

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] websock: fix handshake leak
  2018-10-19 10:13 [Qemu-devel] [PATCH] websock: fix handshake leak Marc-André Lureau
@ 2018-10-19 10:26 ` Daniel P. Berrangé
  2018-10-19 12:07 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrangé @ 2018-10-19 10:26 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel, jusual

On Fri, Oct 19, 2018 at 02:13:46PM +0400, Marc-André Lureau wrote:
> Thanks Valgrind:
> 
> ==955== 217 bytes in 1 blocks are definitely lost in loss record 275 of 321
> ==955==    at 0x483A965: realloc (vg_replace_malloc.c:785)
> ==955==    by 0x50B6839: __vasprintf_chk (in /usr/lib64/libc-2.28.so)
> ==955==    by 0x49AA05C: g_vasprintf (in /usr/lib64/libglib-2.0.so.0.5800.1)
> ==955==    by 0x4983440: g_strdup_vprintf (in /usr/lib64/libglib-2.0.so.0.5800.1)
> ==955==    by 0x126048: qio_channel_websock_handshake_send_res (channel-websock.c:162)
> ==955==    by 0x1266E6: qio_channel_websock_handshake_send_res_ok (channel-websock.c:362)
> ==955==    by 0x126D3E: qio_channel_websock_handshake_process (channel-websock.c:468)
> ==955==    by 0x126EF2: qio_channel_websock_handshake_read (channel-websock.c:511)
> ==955==    by 0x12715B: qio_channel_websock_handshake_io (channel-websock.c:571)
> ==955==    by 0x125027: qio_channel_fd_source_dispatch (channel-watch.c:84)
> ==955==    by 0x496326C: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.5800.1)
> ==955==    by 0x169EC3: glib_pollfds_poll (main-loop.c:215)
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  io/channel-websock.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/io/channel-websock.c b/io/channel-websock.c
> index e6608b969d..dc43dc6bb9 100644
> --- a/io/channel-websock.c
> +++ b/io/channel-websock.c
> @@ -163,6 +163,7 @@ qio_channel_websock_handshake_send_res(QIOChannelWebsock *ioc,
>      responselen = strlen(response);
>      buffer_reserve(&ioc->encoutput, responselen);
>      buffer_append(&ioc->encoutput, response, responselen);
> +    g_free(response);
>      va_end(vargs);
>  }

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] websock: fix handshake leak
  2018-10-19 10:13 [Qemu-devel] [PATCH] websock: fix handshake leak Marc-André Lureau
  2018-10-19 10:26 ` Daniel P. Berrangé
@ 2018-10-19 12:07 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-10-19 12:07 UTC (permalink / raw)
  To: Marc-André Lureau, qemu-devel; +Cc: jusual

On 19/10/2018 12:13, Marc-André Lureau wrote:
> Thanks Valgrind:
> 
> ==955== 217 bytes in 1 blocks are definitely lost in loss record 275 of 321
> ==955==    at 0x483A965: realloc (vg_replace_malloc.c:785)
> ==955==    by 0x50B6839: __vasprintf_chk (in /usr/lib64/libc-2.28.so)
> ==955==    by 0x49AA05C: g_vasprintf (in /usr/lib64/libglib-2.0.so.0.5800.1)
> ==955==    by 0x4983440: g_strdup_vprintf (in /usr/lib64/libglib-2.0.so.0.5800.1)
> ==955==    by 0x126048: qio_channel_websock_handshake_send_res (channel-websock.c:162)
> ==955==    by 0x1266E6: qio_channel_websock_handshake_send_res_ok (channel-websock.c:362)
> ==955==    by 0x126D3E: qio_channel_websock_handshake_process (channel-websock.c:468)
> ==955==    by 0x126EF2: qio_channel_websock_handshake_read (channel-websock.c:511)
> ==955==    by 0x12715B: qio_channel_websock_handshake_io (channel-websock.c:571)
> ==955==    by 0x125027: qio_channel_fd_source_dispatch (channel-watch.c:84)
> ==955==    by 0x496326C: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.5800.1)
> ==955==    by 0x169EC3: glib_pollfds_poll (main-loop.c:215)
> 
Oops..

Missed in f69a8bde293.

> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  io/channel-websock.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/io/channel-websock.c b/io/channel-websock.c
> index e6608b969d..dc43dc6bb9 100644
> --- a/io/channel-websock.c
> +++ b/io/channel-websock.c
> @@ -163,6 +163,7 @@ qio_channel_websock_handshake_send_res(QIOChannelWebsock *ioc,
>      responselen = strlen(response);
>      buffer_reserve(&ioc->encoutput, responselen);
>      buffer_append(&ioc->encoutput, response, responselen);
> +    g_free(response);
>      va_end(vargs);
>  }
>  
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-19 12:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-19 10:13 [Qemu-devel] [PATCH] websock: fix handshake leak Marc-André Lureau
2018-10-19 10:26 ` Daniel P. Berrangé
2018-10-19 12:07 ` Philippe Mathieu-Daudé

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).