* [PATCH] drm/fbdev: fix a memory leak on the dmt_mode object
@ 2020-06-17 16:44 Colin King
0 siblings, 0 replies; only message in thread
From: Colin King @ 2020-06-17 16:44 UTC (permalink / raw)
To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Daniel Vetter, dri-devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Object drm_mode is allocated by the call to drm_mode_find_dmt
(via the call to drm_mode_duplicate and drm_mode_create). The
object is never free'd and hence causes a small memory leak.
Fix this by kfree'ing drm_mode once it is no longer required.
Addresses-Coverity: ("Resource leak")
Fixes: 1d42bbc8f7f9 ("drm/fbdev: fix cloning on fbcon")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/gpu/drm/drm_client_modeset.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index b7e9e1c2564c..c0119e4db045 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -324,6 +324,8 @@ static bool drm_client_target_cloned(struct drm_device *dev,
can_clone = false;
}
+ kfree(dmt_mode);
+
if (can_clone) {
DRM_DEBUG_KMS("can clone using 1024x768\n");
return true;
--
2.27.0.rc0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-17 16:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-17 16:44 [PATCH] drm/fbdev: fix a memory leak on the dmt_mode object Colin King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).