mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-05 15:48:05 +02:00
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
This commit is contained in:
parent
0eee939d76
commit
eb866cd9fe
1 changed files with 4 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue