[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 09:25:32 PDT 2014


On Fri, Sep 19, 2014 at 09:09:43AM -0500, Jeremy White wrote:
> Hey Christophe,
> 
> Thanks for the patch review.
> 
> >>+    memset(&data, 0, sizeof(data));
> >
> >Could this be written as struct audio_data data = { 0, }; or something
> >like that?
> 
> Sure.
> 
> Note, though, that afaict, memset(...0...) seems more prevalent in the spice
> code than the universal zero initializer.

memset is fine with me. I'm also a bit curious about the warnings you
got, but I guess you no longer have these around.

> 
> But I need to break my grumpy K&R edition 1 only ways, so it'll be a good
> exercise for me <grin>.
> 
> >The memset(data.buffer, 0, data.buffer_bytes); call below becomes
> >redundant if I''m not mistaken.
> 
> No, that's malloc'd.  (I suppose it should probably be a calloc, but I'd
> feel that would be out of scope for this patch).

Indeed it is, my bad.

ACK patch.

Christophe
-------------- 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/fa00889b/attachment.sig>


More information about the Spice-devel mailing list