diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-07-07 16:46:22 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-07-08 13:42:50 +1000 |
commit | 225071e2e67fb65a0258397212f9826c9b25e078 (patch) | |
tree | 2b39c830bc95f911f52092749b99e24f3a0d5c22 /src/XIQueryDevice.c | |
parent | 55157345c261653160e0f55841dcb32910ae4106 (diff) |
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 <peter.hutterer@who-t.net>
Diffstat (limited to 'src/XIQueryDevice.c')
-rw-r--r-- | src/XIQueryDevice.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); } |