[PATCH 3/3] Xi: if XTEST device creation fails, fail the master devices.

Peter Hutterer peter.hutterer at who-t.net
Sun Nov 7 16:06:33 PST 2010


When getting close to the MAXDEVICES limit, the creation of XTEST devices
may fail due to device id exhaustion. In that case, fail the creation of
master devices too and return an error to the client.

Theoretically, we could alloc the MDs without the XTEST devices but that
will get interesting when a client starts sending XTEST events through those
devices.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/xichangehierarchy.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index b7140d5..b9cdedf 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -157,7 +157,11 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
     /* Allocate virtual slave devices for xtest events */
     rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd, ptr, keybd);
     if (rc != Success)
+    {
+        DeleteInputDeviceRequest(ptr);
+        DeleteInputDeviceRequest(keybd);
         goto unwind;
+    }
 
     ActivateDevice(ptr, FALSE);
     ActivateDevice(keybd, FALSE);
-- 
1.7.3.2



More information about the xorg-devel mailing list