@@ -10711,6 +10711,7 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct drm_device *dev = crtc->dev;
struct intel_unpin_work *work;
+ char *name;
spin_lock_irq(&dev->event_lock);
work = intel_crtc->unpin_work;
@@ -10722,8 +10723,13 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)
kfree(work);
}
+ /*
+ * drm_crtc_cleanup() zeroes the structure, so
+ * need an extra dance to avoid leaking the name.
+ */
+ name = crtc->name;
drm_crtc_cleanup(crtc);
-
+ kfree(name);
kfree(intel_crtc);
}
@@ -14036,6 +14042,11 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
if (intel_crtc == NULL)
return;
+ intel_crtc->base.name = kasprintf(GFP_KERNEL, "pipe %c",
+ pipe_name(pipe));
+ if (!intel_crtc->base.name)
+ return;
+
crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
if (!crtc_state)
goto fail;
@@ -14106,6 +14117,7 @@ fail:
if (cursor)
drm_plane_cleanup(cursor);
kfree(crtc_state);
+ kfree(intel_crtc->base.name);
kfree(intel_crtc);
}