linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: mc-device.c: fix memleak in media_device_register_entity
@ 2019-08-16  3:33 zhengbin
  2019-08-16  9:49 ` Sakari Ailus
  2019-08-16 11:57 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: zhengbin @ 2019-08-16  3:33 UTC (permalink / raw)
  To: sakari.ailus, laurent.pinchart, mchehab, linux-media; +Cc: yi.zhang, zhengbin13

In media_device_register_entity, if media_graph_walk_init fails,
need to free the previously memory.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
 drivers/media/mc/mc-device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/mc/mc-device.c b/drivers/media/mc/mc-device.c
index e19df51..939be00 100644
--- a/drivers/media/mc/mc-device.c
+++ b/drivers/media/mc/mc-device.c
@@ -632,6 +632,7 @@ int __must_check media_device_register_entity(struct media_device *mdev,
 		 */
 		ret = media_graph_walk_init(&new, mdev);
 		if (ret) {
+			__media_device_unregister_entity(entity);
 			mutex_unlock(&mdev->graph_mutex);
 			return ret;
 		}
--
2.7.4


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

end of thread, other threads:[~2019-08-16 11:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-16  3:33 [PATCH] media: mc-device.c: fix memleak in media_device_register_entity zhengbin
2019-08-16  9:49 ` Sakari Ailus
2019-08-16 11:57 ` kbuild test robot

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).