All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/atomic: fix memory leak when fetching format name
@ 2016-11-11 16:26 Colin King
  2016-11-11 17:17   ` Eric Engestrom
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2016-11-11 16:26 UTC (permalink / raw)
  To: David Airlie, dri-devel; +Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

drm_get_format_name allocates memory that is not currently free'd
when printing the state. Fix this by kfree'ing the memory after
use.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/drm_atomic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index f5ea7db..1d5e86a 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -917,9 +917,10 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,
 	if (state->fb) {
 		struct drm_framebuffer *fb = state->fb;
 		int i, n = drm_format_num_planes(fb->pixel_format);
+		char *format_name = drm_get_format_name(fb->pixel_format);
 
-		drm_printf(p, "\t\tformat=%s\n",
-				drm_get_format_name(fb->pixel_format));
+		drm_printf(p, "\t\tformat=%s\n", format_name);
+		kfree(format_name);
 		drm_printf(p, "\t\tsize=%dx%d\n", fb->width, fb->height);
 		drm_printf(p, "\t\tlayers:\n");
 		for (i = 0; i < n; i++) {
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-11 17:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-11 16:26 [PATCH] drm/atomic: fix memory leak when fetching format name Colin King
2016-11-11 17:17 ` Eric Engestrom
2016-11-11 17:17   ` Eric Engestrom

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.