compositor-drm: Fix memory leak in create_output_for_connector
We do not free the encoder structure on failure. Fix that. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
7551cff986
commit
eb8bed5c73
@@ -445,12 +445,15 @@ create_output_for_connector(struct drm_compositor *ec,
|
|||||||
}
|
}
|
||||||
if (i == resources->count_crtcs) {
|
if (i == resources->count_crtcs) {
|
||||||
fprintf(stderr, "No usable crtc for encoder.\n");
|
fprintf(stderr, "No usable crtc for encoder.\n");
|
||||||
|
drmModeFreeEncoder(encoder);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
output = malloc(sizeof *output);
|
output = malloc(sizeof *output);
|
||||||
if (output == NULL)
|
if (output == NULL) {
|
||||||
|
drmModeFreeEncoder(encoder);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
memset(output, 0, sizeof *output);
|
memset(output, 0, sizeof *output);
|
||||||
output->base.subpixel = drm_subpixel_to_wayland(connector->subpixel);
|
output->base.subpixel = drm_subpixel_to_wayland(connector->subpixel);
|
||||||
|
|||||||
Reference in New Issue
Block a user