[Spice-devel] [PATCH xf86-video-qxl] In XSpice audio, fully clear the data structure; silences valgrind warnings.

Christophe Fergeau cfergeau at redhat.com
Fri Sep 19 02:53:36 PDT 2014


On Mon, Sep 15, 2014 at 11:26:14AM -0500, Jeremy White wrote:
> 
> Signed-off-by: Jeremy White <jwhite at codeweavers.com>
> ---
>  src/spiceqxl_audio.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/spiceqxl_audio.c b/src/spiceqxl_audio.c
> index 7afc089..02859ee 100644
> --- a/src/spiceqxl_audio.c
> +++ b/src/spiceqxl_audio.c
> @@ -195,10 +195,10 @@ audio_thread_main (void *p)
>      struct audio_data data;
>      int freq = SPICE_INTERFACE_PLAYBACK_FREQ;
>  
> +    memset(&data, 0, sizeof(data));

Could this be written as struct audio_data data = { 0, }; or something
like that?
The memset(data.buffer, 0, data.buffer_bytes); call below becomes
redundant if I''m not mistaken.

Christophe

>      for (i = 0; i < MAX_FIFOS; ++i)
>          data.fifo_fds[i] = -1;
>  
> -    data.valid_bytes = data.fed = 0;
>  #if SPICE_INTERFACE_PLAYBACK_MAJOR > 1 || SPICE_INTERFACE_PLAYBACK_MINOR >= 3
>      freq = spice_server_get_best_playback_rate(&qxl->playback_sin);
>  #endif
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140919/07b9ba3a/attachment.sig>


More information about the Spice-devel mailing list