drm-lease-v1: Free the wlr_drm_lease_v1 on error

This commit is contained in:
Kenny Levinsen 2024-02-22 00:36:25 +01:00
parent 8dec0f6174
commit 0cb091f1a2

View File

@ -177,6 +177,7 @@ struct wlr_drm_lease_v1 *wlr_drm_lease_request_v1_grant(
if (!lease->drm_lease) { if (!lease->drm_lease) {
wlr_log(WLR_ERROR, "wlr_drm_create_lease failed"); wlr_log(WLR_ERROR, "wlr_drm_create_lease failed");
wp_drm_lease_v1_send_finished(lease->resource); wp_drm_lease_v1_send_finished(lease->resource);
free(lease);
return NULL; return NULL;
} }
@ -185,6 +186,7 @@ struct wlr_drm_lease_v1 *wlr_drm_lease_request_v1_grant(
wlr_log(WLR_ERROR, "Failed to allocate lease connectors list"); wlr_log(WLR_ERROR, "Failed to allocate lease connectors list");
close(fd); close(fd);
wp_drm_lease_v1_send_finished(lease->resource); wp_drm_lease_v1_send_finished(lease->resource);
free(lease);
return NULL; return NULL;
} }
lease->n_connectors = request->n_connectors; lease->n_connectors = request->n_connectors;