This function is nonetheless rather dubious. Common may be shared between multiple devices. AFAIU this code sets xCapacity to -10101 so that when UnInit is called on the other devices they don't double free. It's almost like a poor man's refcounting, but with a lot less refcounting and a lot more guffawing.
Signed-off-by: Peter Hutterer <[email protected]> --- src/xf86Aiptek.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/xf86Aiptek.c b/src/xf86Aiptek.c index 8421a70..3a60d13 100644 --- a/src/xf86Aiptek.c +++ b/src/xf86Aiptek.c @@ -1781,12 +1781,15 @@ xf86AiptekUninit(InputDriverPtr drv, DBG(1, "xf86AiptekUninit\n"); - if (device->common && device->common->xCapacity != -10101) + if (device) { - device->common->xCapacity = -10101; - free(device->common); + if (device->common && device->common->xCapacity != -10101) + { + device->common->xCapacity = -10101; + free(device->common); + } + free (device); } - free (device); pInfo->private = NULL; xf86DeleteInput(pInfo, 0); } -- 1.7.5.4 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
