summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/XIQueryDevice.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/XIQueryDevice.c b/src/XIQueryDevice.c
index af2f27a..66452c2 100644
--- a/src/XIQueryDevice.c
+++ b/src/XIQueryDevice.c
@@ -71,6 +71,7 @@ XIQueryDevice(Display *dpy, int deviceid, int *ndevices_return)
for (i = 0; i < reply.num_devices; i++)
{
int nclasses;
+ size_t sz;
XIDeviceInfo *lib = &info[i];
xXIDeviceInfo *wire = (xXIDeviceInfo*)ptr;
@@ -86,7 +87,8 @@ XIQueryDevice(Display *dpy, int deviceid, int *ndevices_return)
strncpy(lib->name, ptr, wire->name_len);
ptr += ((wire->name_len + 3)/4) * 4;
- lib->classes = Xmalloc(size_classes((xXIAnyInfo*)ptr, nclasses));
+ sz = size_classes((xXIAnyInfo*)ptr, nclasses);
+ lib->classes = Xmalloc(sz);
ptr += copy_classes(lib, (xXIAnyInfo*)ptr, &nclasses);
/* We skip over unused classes */
lib->num_classes = nclasses;