[JANITOR] Request for review

Kayo Hamid khflab at gmail.com
Sat Aug 6 06:22:19 UTC 2016


Thanks, i'll adjust my code and send the patch after my build success.

2016-08-06 1:30 GMT-04:00 Keith Packard <keithp at keithp.com>:

> Kayo Hamid <khflab at gmail.com> writes:
>
> > I'm trying to do one janitor task looking for bad allocations. Someone
> > could review my diff and see if is okay?
> >
> > Thanks.
> >
> > --
> > Kayo Hamid
> > diff --git a/dix/enterleave.c b/dix/enterleave.c
> > index 1b341f2..8cec9a2 100644
> > --- a/dix/enterleave.c
> > +++ b/dix/enterleave.c
> > @@ -715,6 +715,13 @@ DeliverStateNotifyEvent(DeviceIntPtr dev,
> WindowPtr win)
> >      }
> >
> >      sev = ev = xallocarray(evcount, sizeof(xEvent));
> > +
> > +    if(!ev) {
> > +        free(ev);
> > +        free(sev);
> > +        return BadAlloc;
> > +    }
> > +
>
> Good catch on the allocation failure, but in this case you don't need to
> free anything, and you should make sure your code compiles without
> warnings as this function is void, and so wouldn't need a return value.
>
> --
> -keith
>



-- 
Kayo Hamid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160806/3c9277a7/attachment.html>


More information about the xorg-devel mailing list