diff --git a/src/modesetting.c b/src/modesetting.c index ddf642f1..bc62072a 100644 --- a/src/modesetting.c +++ b/src/modesetting.c @@ -2951,14 +2951,15 @@ kms_req_commit_common(struct kms_req *req, bool blocking, kms_scanout_cb_t scano builder->drmdev->per_crtc_state[builder->crtc->index].userdata = NULL; goto fail_unlock; -fail_unref_builder: - struct drmdev *drmdev = builder->drmdev; - kms_req_builder_unref(builder); - if (mode_blob != NULL) { - drm_mode_blob_destroy(mode_blob); +fail_unref_builder: { + struct drmdev *drmdev = builder->drmdev; + kms_req_builder_unref(builder); + if (mode_blob != NULL) { + drm_mode_blob_destroy(mode_blob); + } + drmdev_unlock(drmdev); + return ok; } - drmdev_unlock(drmdev); - return ok; fail_maybe_destroy_mode_blob: if (mode_blob != NULL)