[Spice-devel] [PATCH spice-gtk] RFC: usbredir: fix leaks introduced by lz4 patch
Marc-André Lureau
mlureau at redhat.com
Wed Jul 27 16:25:48 UTC 2016
hi
----- Original Message -----
> Hi,
>
>
> On 07/11/2016 06:16 PM, marcandre.lureau at redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau at redhat.com>
> >
> > While reviewing lz4 patch, I found that there are potential leaks. This
> > is untested, fyi. It would be nice if someone could confirm with running
> > ASAN for example.
> Thanks for reviewing this:)
> I've made some testing with valgrind, it seems like the leakage does not
> exist anymore after applying this patch.
> Snir.
thanks, you add your reviewed-by and I'll commit it?
> > Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> > ---
> > src/channel-usbredir.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
> > index 9c71c07..85f16d7 100644
> > --- a/src/channel-usbredir.c
> > +++ b/src/channel-usbredir.c
> > @@ -692,13 +692,13 @@ static int
> > try_write_compress_LZ4(SpiceUsbredirChannel *channel, uint8_t *data,
> > spice_marshaller_add_ref_full(msg_out_compressed->marshaller,
> > compressed_data_msg.compressed_data,
> > compressed_data_count,
> > - usbredir_free_write_cb_data,
> > +
> > (spice_marshaller_item_free_func)g_free,
> > channel);
> > spice_msg_out_send(msg_out_compressed);
> > return TRUE;
> > }
> > /* if not - free & fallback to sending the message uncompressed */
> > - free(compressed_buf);
> > + g_free(compressed_buf);
> > return FALSE;
> > }
> > #endif
> > @@ -709,8 +709,10 @@ static int usbredir_write_callback(void *user_data,
> > uint8_t *data, int count)
> > SpiceMsgOut *msg_out;
> >
> > #ifdef USE_LZ4
> > - if (try_write_compress_LZ4(channel, data, count))
> > + if (try_write_compress_LZ4(channel, data, count)) {
> > + usbredirhost_free_write_buffer(channel->priv->host, data);
> > return count;
> > + }
> > #endif
> > msg_out = spice_msg_out_new(SPICE_CHANNEL(channel),
> > SPICE_MSGC_SPICEVMC_DATA);
>
>
More information about the Spice-devel
mailing list