summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-05-30 13:49:39 +1000
committerDave Airlie <airlied@redhat.com>2008-05-30 13:49:39 +1000
commit1c4b25a2b1c31df190eab173128702d1b5871906 (patch)
treead646ac1c6cd2231176e24c72aa10129d16592f8 /libdrm
parent9239cf511f65a43eb578fbb6a7c5255e05db2101 (diff)
drm: fix a couple of bugs in the encoder return to userspace
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drmMode.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index 78efe827..0824ec3f 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -167,6 +167,7 @@ drmModeResPtr drmModeGetResources(int fd)
r->count_fbs = res.count_fbs;
r->count_crtcs = res.count_crtcs;
r->count_outputs = res.count_outputs;
+ r->count_encoders = res.count_encoders;
/* TODO we realy should test if these allocs fails. */
r->fbs = drmAllocCpy(U642VOID(res.fb_id_ptr), res.count_fbs, sizeof(uint32_t));
r->crtcs = drmAllocCpy(U642VOID(res.crtc_id_ptr), res.count_crtcs, sizeof(uint32_t));
@@ -358,6 +359,9 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
if (ioctl(fd, DRM_IOCTL_MODE_GETENCODER, &enc))
return 0;
+ if (!(r = drmMalloc(sizeof(*r))))
+ return 0;
+
r->encoder_type = enc.encoder_type;
r->crtcs = enc.crtcs;
r->clones = enc.clones;