[Spice-devel] udscs: The read buffer is always reset to NULL

Christophe Fergeau cfergeau at redhat.com
Mon Nov 28 09:54:26 UTC 2016


On Mon, Nov 28, 2016 at 09:40:56AM +0100, Francois Gouget wrote:
> Tweak the code to clarify that conn->data.buf is set to NULL after the
> free() in udscs_read_complete().
> Note that this reset is needed to avoid a double-free in
> udscs_destroy_connection() if an error occurs while receiving
> the next message header.
> 
> Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> ---
> 
> On Fri, 25 Nov 2016, Christophe Fergeau wrote:
> >
> > This memset should 'buf' to NULL. (can't remember if I took that into
> > account while writing the patch though :)
> 
> Maybe tweaking the code like below could help make this clearer. The 
> comment may be overkill, or maybe on the contrary it should be made more 
> explicit.

Does not hurt to make this explicit indeed,

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20161128/f80dc52f/attachment.sig>


More information about the Spice-devel mailing list