summaryrefslogtreecommitdiff
path: root/src/XListDProp.c
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-29 19:30:30 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-29 19:30:30 -0200
commitba2546a51d5f9087ec54fba7cae46ea1f210198a (patch)
tree28174a09aa886ad0914de2ab787484ac8e6fb538 /src/XListDProp.c
parent4a1d1ff1195a2ed43ace1a33e429f2272f1331af (diff)
downloadxorg-lib-libXi-ba2546a51d5f9087ec54fba7cae46ea1f210198a.tar.gz
Return NULL on error, and match LockDisplay with UnlockDisplay.
Diffstat (limited to 'src/XListDProp.c')
-rw-r--r--src/XListDProp.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/XListDProp.c b/src/XListDProp.c
index aee2737..66b9eca 100644
--- a/src/XListDProp.c
+++ b/src/XListDProp.c
@@ -49,33 +49,31 @@ XListDeviceProperties(Display* dpy, XDevice* dev, int *nprops_return)
Atom *props = NULL;
LockDisplay(dpy);
+ *nprops_return = 0;
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
- return (NoSuchExtension);
+ goto cleanup;
GetReq(ListDeviceProperties, req);
req->reqType = info->codes->major_opcode;
req->ReqType = X_ListDeviceProperties;
req->deviceid = dev->device_id;
- if (!_XReply(dpy, (xReply*)&rep, 0, xFalse)) {
- *nprops_return = 0;
+ if (!_XReply(dpy, (xReply*)&rep, 0, xFalse))
goto cleanup;
- }
-
- *nprops_return = rep.nAtoms;
if (rep.nAtoms) {
props = (Atom*)Xmalloc(rep.nAtoms * sizeof(Atom));
if (!props)
{
_XEatData(dpy, rep.nAtoms << 2);
- *nprops_return = 0;
goto cleanup;
}
_XRead32(dpy, props, rep.nAtoms << 2);
}
+ *nprops_return = rep.nAtoms;
+
cleanup:
UnlockDisplay(dpy);
SyncHandle();