Xi: silence valgrind warning. (#36120)

Conditional jump or move depends on uninitialised value(s)
   at 0x4357A1: GetEventMask (events.c:454)
   by 0x43B9E8: DeliverEventsToWindow (events.c:2029)
   by 0x4E0C59: SendEventToAllWindows (exevents.c:2125)
   by 0x4E8301: XISendDeviceHierarchyEvent (xichangehierarchy.c:118)
   by 0x426F99: DisableDevice (devices.c:507)
   by 0x46BF72: xf86Wakeup (xf86Events.c:457)
   by 0x432ABA: WakeupHandler (dixutils.c:419)
   by 0x45B708: WaitForSomething (WaitFor.c:235)
   by 0x42E8D9: Dispatch (dispatch.c:367)
   by 0x422DC9: main (main.c:287)
 Uninitialised value was created by a stack allocation
   at 0x4E8190: XISendDeviceHierarchyEvent (xichangehierarchy.c:61)

Conditional jump or move depends on uninitialised value(s)
   at 0x43BB78: DeliverEventsToWindow (events.c:2010)
   by 0x4DDEEA: FindInterestedChildren (exevents.c:2103)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4E0C6F: SendEventToAllWindows (exevents.c:2127)
   by 0x4E8301: XISendDeviceHierarchyEvent (xichangehierarchy.c:118)
   by 0x426F99: DisableDevice (devices.c:507)
   by 0x46BF72: xf86Wakeup (xf86Events.c:457)
   by 0x432ABA: WakeupHandler (dixutils.c:419)
   by 0x45B708: WaitForSomething (WaitFor.c:235)
 Uninitialised value was created by a stack allocation
   at 0x4E8190: XISendDeviceHierarchyEvent (xichangehierarchy.c:61)

Set the type of dummyDev to SLAVE. The jump listed above comes from a check
to IsMaster() in GetEventMask() that would then set the
XIAllMasterDevices mask.
Hierarchy events can only be set for XIAllDevices so the above IsMaster()
check had no effect and the device type doesn't really matter anyway beyond
shuting up valgrind.

Also initialize dummyDev to 0 to ease future debugging.

X.Org Bug 36120 <http://bugs.freedesktop.org/show_bug.cgi?id=36120>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2011-04-11 11:24:29 +10:00
parent 419a27b521
commit f0f0eec869

View File

@ -116,7 +116,9 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
ev->length = bytes_to_int32(ev->num_info * sizeof(xXIHierarchyInfo));
memset(&dummyDev, 0, sizeof(dummyDev));
dummyDev.id = XIAllDevices;
dummyDev.type = SLAVE;
SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1);
free(ev);
}