[PATCH] drm/gma500: fix memory leaks

From: Wenwen Wang
Date: Sun Aug 18 2019 - 23:13:32 EST


In mdfld_dsi_output_init(), if mdfld_dsi_pkg_sender_init() fails, the
execution is directed to the 'dsi_init_err0' label. However, some
previously allocated buffers and resources are not deallocated, leading to
memory/resource leaks. To fix this issue, revise the 'dsi_init_err0' label.

Signed-off-by: Wenwen Wang <wenwen@xxxxxxxxxx>
---
drivers/gpu/drm/gma500/mdfld_dsi_output.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
index 03023fa..ab9e935 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
@@ -592,11 +592,10 @@ void mdfld_dsi_output_init(struct drm_device *dev,
dsi_init_err1:
/*destroy sender*/
mdfld_dsi_pkg_sender_destroy(dsi_connector->pkg_sender);
-
+dsi_init_err0:
drm_connector_cleanup(connector);

kfree(dsi_config->fixed_mode);
kfree(dsi_config);
-dsi_init_err0:
kfree(dsi_connector);
}
--
2.7.4