plane_add_damage() leaks DRM blobs
plane_add_damage()
has the following code:
ret = drmModeCreatePropertyBlob(backend->drm.fd, rects,
sizeof(*rects) * n_rects, &blob_id);
if (ret != 0)
return ret;
ret = plane_add_prop(req, plane, WDRM_PLANE_FB_DAMAGE_CLIPS, blob_id);
if (ret != 0)
return ret;
return 0;
I do not see the corresponding drmModeDestroyPropertyBlob()
call anywhere.
A DRM blob (ID) is refcounted. A blob we create has a reference from our DRM device file description. We can free that reference with either drmModeDestroyPropertyBlob()
or by closing the DRM device. Since the kernel will properly refcount blobs, we can just drmModeDestroyPropertyBlob()
after calling drmModeAtomicCommit()
that latches it in. We don't need to wait for the blob to become unused like we do with FBs.