From 225071e2e67fb65a0258397212f9826c9b25e078 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 7 Jul 2009 16:46:22 +1000 Subject: Split copy_classes and size_classes to avoid memory leak The switch to cookie events introduced a memory leak in XIDeviceChangedEvents. Signed-off-by: Peter Hutterer --- src/XIQueryDevice.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/XIQueryDevice.c') diff --git a/src/XIQueryDevice.c b/src/XIQueryDevice.c index ec4e601..34c38cb 100644 --- a/src/XIQueryDevice.c +++ b/src/XIQueryDevice.c @@ -30,7 +30,7 @@ #include "XIint.h" extern int copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses); -extern int sizeDeviceClassType(int type, int num_elements); +extern int size_classes(xXIAnyInfo* from, int nclasses); XIDeviceInfo* XIQueryDevice(Display *dpy, int deviceid, int *ndevices_return) @@ -86,6 +86,7 @@ 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, lib->num_classes)); ptr += copy_classes(lib, (xXIAnyInfo*)ptr, lib->num_classes); } -- cgit v1.2.3