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>
dev
David Herrmann 13 years ago committed by Kristian Høgsberg
parent 7551cff986
commit eb8bed5c73
  1. 5
      compositor/compositor-drm.c

@ -445,12 +445,15 @@ create_output_for_connector(struct drm_compositor *ec,
}
if (i == resources->count_crtcs) {
fprintf(stderr, "No usable crtc for encoder.\n");
drmModeFreeEncoder(encoder);
return -1;
}
output = malloc(sizeof *output);
if (output == NULL)
if (output == NULL) {
drmModeFreeEncoder(encoder);
return -1;
}
memset(output, 0, sizeof *output);
output->base.subpixel = drm_subpixel_to_wayland(connector->subpixel);

Loading…
Cancel
Save