Re: [JANITOR] Request for review
Thanks, i'll adjust my code and send the patch after my build success. 2016-08-06 1:30 GMT-04:00 Keith Packard : > Kayo Hamid 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 ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
Re: [JANITOR] Request for review
Kayo Hamid 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 signature.asc Description: PGP signature ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
[JANITOR] Request for review
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; +} + FixDeviceStateNotify(dev, ev, NULL, NULL, NULL, first); if (b != NULL) { ___ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel