From 71fd4d1dbac8feef1f24eb775982ab28db9d0fdf Mon Sep 17 00:00:00 2001 From: heinzelotto Date: Mon, 24 Oct 2016 23:03:11 +0200 Subject: [PATCH] Fixes memory leak in function drm_atomic_replace_property_blob_from_id. This function calls drm_property_lookup_blob(...) (which implicitly increases the refcount on the retrieved blob by one), but then fails to call drm_property_unreference_blob on it. --- drivers/gpu/drm/drm_atomic.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 2373960..d43e7eb8 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -427,11 +427,18 @@ drm_atomic_replace_property_blob_from_id(struct drm_crtc *crtc, new_blob = drm_property_lookup_blob(dev, blob_id); if (new_blob == NULL) return -EINVAL; - if (expected_size > 0 && expected_size != new_blob->length) + if (expected_size > 0 && expected_size != new_blob->length) { + drm_property_unreference_blob(new_blob); return -EINVAL; - } + } + + drm_atomic_replace_property_blob(blob, new_blob, replaced); - drm_atomic_replace_property_blob(blob, new_blob, replaced); + drm_property_unreference_blob(new_blob); + + } else { + drm_atomic_replace_property_blob(blob, new_blob, replaced); + } return 0; } -- 2.10.1