diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-01-06 16:53:33 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-01-06 16:54:22 +0000 |
commit | e6c136ca7a4c54457b48be1aec2be024b3e4a28d (patch) | |
tree | 3e9d60ab0eadecf130f6587338bf60b4a2e39d9e | |
parent | 85fb3e55fdb7af9b5f59c1ec0f15d1950e601b05 (diff) |
modes: Fix previous commit for potential legal NULLs
If the count is 0, then the malloc is permitted to return NULL, so don't
throw an error in that case.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | xf86drmMode.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xf86drmMode.c b/xf86drmMode.c index 44ef05bc..cfdee4a9 100644 --- a/xf86drmMode.c +++ b/xf86drmMode.c @@ -206,7 +206,11 @@ retry: r->crtcs = drmAllocCpy(U642VOID(res.crtc_id_ptr), res.count_crtcs, sizeof(uint32_t)); r->connectors = drmAllocCpy(U642VOID(res.connector_id_ptr), res.count_connectors, sizeof(uint32_t)); r->encoders = drmAllocCpy(U642VOID(res.encoder_id_ptr), res.count_encoders, sizeof(uint32_t)); - if (!r->fbs || !r->crtcs || !r->connectors || !r->encoders) { + if ((res.count_fbs && !r->fbs) || + (res.count_crtcs && !r->crtcs) || + (res.count_connectors && !r->connectors) || + (res.count_encoders && !r->encoders)) + { drmFree(r->fbs); drmFree(r->crtcs); drmFree(r->connectors); |