[PATCH xserver] dix: Don't leak swapped events

Adam Jackson ajax at redhat.com
Wed Mar 29 15:09:36 UTC 2017


On Wed, 2017-03-29 at 10:28 +1000, Peter Hutterer wrote:
> On Tue, Mar 28, 2017 at 01:42:21PM -0400, Adam Jackson wrote:
> >          for (i = 0; i < count; i++) {
> > -            eventFrom = &events[i];
> > -            eventTo = swapEvent;
> > +            xEvent swapped;
> 
> as keith already pointed out, this will break for generic events. but you
> can still get the same effect by switching to
>    unsigned char buffer[eventlength];
>    xEvent *swapped = buffer;
> and get rid of the heap allocation this way.

Are we okay with VLAs now? I mean, I am, just it's not currently one of
the C extensions we require.

- ajax


More information about the xorg-devel mailing list