[PATCH v2] drm/gma500: fix memory leaks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux