linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: zhengbin <zhengbin13@huawei.com>
To: <sakari.ailus@linux.intel.com>,
	<laurent.pinchart@ideasonboard.com>, <mchehab@kernel.org>,
	<linux-media@vger.kernel.org>
Cc: <yi.zhang@huawei.com>, <zhengbin13@huawei.com>
Subject: [PATCH] media: mc-device.c: fix memleak in media_device_register_entity
Date: Fri, 16 Aug 2019 11:33:02 +0800	[thread overview]
Message-ID: <1565926382-91620-1-git-send-email-zhengbin13@huawei.com> (raw)

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


             reply	other threads:[~2019-08-16  3:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16  3:33 zhengbin [this message]
2019-08-16  9:49 ` [PATCH] media: mc-device.c: fix memleak in media_device_register_entity Sakari Ailus
2019-08-16 11:57 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1565926382-91620-1-git-send-email-zhengbin13@huawei.com \
    --to=zhengbin13@huawei.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).