[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1566185684-8014-1-git-send-email-wenwen@cs.uga.edu>
Date: Sun, 18 Aug 2019 22:34:30 -0500
From: Wenwen Wang <wenwen@...uga.edu>
To: Wenwen Wang <wenwen@...uga.edu>
Cc: Patrik Jakobsson <patrik.r.jakobsson@...il.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH v2] drm/gma500: fix memory leaks
In mdfld_dsi_output_init(), if an error occurs, the execution is directed
to 'dsi_init_err0' or 'dsi_init_err1'. However, in some cases, some
previously allocated buffers and resources are not deallocated, leading to
memory/resource leaks. To fix this issue, revise the labels.
Signed-off-by: Wenwen Wang <wenwen@...uga.edu>
---
drivers/gpu/drm/gma500/mdfld_dsi_output.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
index 03023fa..0cf4121 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
@@ -573,13 +573,13 @@ void mdfld_dsi_output_init(struct drm_device *dev,
if (mdfld_dsi_pkg_sender_init(dsi_connector, pipe)) {
DRM_ERROR("Package Sender initialization failed on pipe %d\n",
pipe);
- goto dsi_init_err0;
+ goto dsi_init_err1;
}
encoder = mdfld_dsi_dpi_init(dev, dsi_connector, p_vid_funcs);
if (!encoder) {
DRM_ERROR("Create DPI encoder failed\n");
- goto dsi_init_err1;
+ goto dsi_init_err2;
}
encoder->private = dsi_config;
dsi_config->encoder = encoder;
@@ -589,14 +589,13 @@ void mdfld_dsi_output_init(struct drm_device *dev,
return;
/*TODO: add code to destroy outputs on error*/
-dsi_init_err1:
+dsi_init_err2:
/*destroy sender*/
mdfld_dsi_pkg_sender_destroy(dsi_connector->pkg_sender);
-
+dsi_init_err1:
drm_connector_cleanup(connector);
-
+dsi_init_err0:
kfree(dsi_config->fixed_mode);
kfree(dsi_config);
-dsi_init_err0:
kfree(dsi_connector);
}
--
2.7.4
Powered by blists - more mailing lists