diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2009-01-29 19:30:30 -0200 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2009-01-29 19:30:30 -0200 |
commit | ba2546a51d5f9087ec54fba7cae46ea1f210198a (patch) | |
tree | 28174a09aa886ad0914de2ab787484ac8e6fb538 | |
parent | 4a1d1ff1195a2ed43ace1a33e429f2272f1331af (diff) |
Return NULL on error, and match LockDisplay with UnlockDisplay.
-rw-r--r-- | src/XListDProp.c | 12 |
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(); |