summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Michael <cpmichael1@comcast.net>2012-03-07 14:55:21 -0500
committerKristian Høgsberg <krh@bitplanet.net>2012-03-08 13:17:11 -0500
commiteb866cd9fe5939efed532f4eb400cd889c00c2f4 (patch)
tree35806c3632f069ca6503267ce6a70736cd182d71
parent0eee939d76a4f3c507785cb40b99ba0d02fc981b (diff)
drm: Fix drmModeRes leak on error paths
When creating outputs in the drm compositor, if allocating crtcs fails, then free the drm resources. Also, if the base output list is empty, free drm resources
-rw-r--r--src/compositor-drm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 9796014..67fa500 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1263,8 +1263,10 @@ create_outputs(struct drm_compositor *ec, int option_connector,
}
ec->crtcs = calloc(resources->count_crtcs, sizeof(uint32_t));
- if (!ec->crtcs)
+ if (!ec->crtcs) {
+ drmModeFreeResources(resources);
return -1;
+ }
ec->num_crtcs = resources->count_crtcs;
memcpy(ec->crtcs, resources->crtcs, sizeof(uint32_t) * ec->num_crtcs);
@@ -1295,6 +1297,7 @@ create_outputs(struct drm_compositor *ec, int option_connector,
if (wl_list_empty(&ec->base.output_list)) {
fprintf(stderr, "No currently active connector found.\n");
+ drmModeFreeResources(resources);
return -1;
}