mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shailendra Verma <shailendra.capricorn@gmail.com>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Riley Andrews" <riandrews@android.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Mitchel Humpherys" <mitchelh@codeaurora.org>,
	"Phong Tran" <tranmanphong@gmail.com>,
	"Mauro Carvalho Chehab" <mchehab@osg.samsung.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"Markus Elfring" <elfring@users.sourceforge.net>,
	devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org,
	Shailendra Verma <shailendra.capricorn@gmail.com>
Subject: [PATCH] Staging:Android:ion - Fix for memory leak if ion device registration get failed.
Date: Tue, 19 May 2015 20:29:00 +0530	[thread overview]
Message-ID: <1432047540-3436-1-git-send-email-shailendra.capricorn@gmail.com> (raw)

Fix to avoid possible memory leak if the ion device registration
get failed.Free the allocated device creation memory before return
in case the ion device registration get failed.

Signed-off-by: Shailendra Verma <shailendra.capricorn@gmail.com>
---
 drivers/staging/android/ion/ion.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index 584a226..b7255a9 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1577,6 +1577,7 @@ struct ion_device *ion_device_create(long (*custom_ioctl)
 	ret = misc_register(&idev->dev);
 	if (ret) {
 		pr_err("ion: failed to register misc device.\n");
+		kfree(idev);
 		return ERR_PTR(ret);
 	}
 
-- 
1.7.9.5


                 reply	other threads:[~2015-05-19 14:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1432047540-3436-1-git-send-email-shailendra.capricorn@gmail.com \
    --to=shailendra.capricorn@gmail.com \
    --cc=arve@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=elfring@users.sourceforge.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mchehab@osg.samsung.com \
    --cc=mitchelh@codeaurora.org \
    --cc=riandrews@android.com \
    --cc=sumit.semwal@linaro.org \
    --cc=tranmanphong@gmail.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

all inboxes | Powered by JetHome®