summaryrefslogtreecommitdiff
path: root/src/XrrProperty.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/XrrProperty.c')
-rw-r--r--src/XrrProperty.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/XrrProperty.c b/src/XrrProperty.c
index 5367e1e..4d5dd1e 100644
--- a/src/XrrProperty.c
+++ b/src/XrrProperty.c
@@ -106,25 +106,27 @@ XRRQueryOutputProperty (Display *dpy, RROutput output, Atom property)
return NULL;
}
- if (rep.length) {
- nbytes = rep.length * sizeof (long);
- netbytes = rep.length << 2;
+ nbytes = rep.length * sizeof (long);
+ netbytes = rep.length << 2;
- prop_info = (XRRPropertyInfo *) Xmalloc (nbytes +
- sizeof (XRRPropertyInfo));
- if (prop_info == NULL) {
- _XEatData (dpy, netbytes);
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
- prop_info->pending = rep.pending;
- prop_info->range = rep.range;
- prop_info->immutable = rep.immutable;
- prop_info->num_values = rep.length;
- prop_info->values = (long *) (prop_info + 1);
+ prop_info = (XRRPropertyInfo *) Xmalloc (nbytes +
+ sizeof (XRRPropertyInfo));
+ if (prop_info == NULL) {
+ _XEatData (dpy, netbytes);
+ UnlockDisplay (dpy);
+ SyncHandle ();
+ return NULL;
+ }
+ prop_info->pending = rep.pending;
+ prop_info->range = rep.range;
+ prop_info->immutable = rep.immutable;
+ prop_info->num_values = rep.length;
+ if (rep.length != 0) {
+ prop_info->values = (long *) (prop_info + 1);
_XRead32 (dpy, prop_info->values, nbytes);
+ } else {
+ prop_info->values = NULL;
}
UnlockDisplay (dpy);