public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Seunghun Lee <waydi1@gmail.com>
To: gregkh@linuxfoundation.org
Cc: gerb.stralko@gmail.com, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, Seunghun Lee <waydi1@gmail.com>,
	Brian Swetland <swetland@google.com>
Subject: [PATCH] staging: android: fix a possible memory leak
Date: Thu, 14 Aug 2014 02:02:48 +0900	[thread overview]
Message-ID: <1407949368-2791-1-git-send-email-waydi1@gmail.com> (raw)

Memory allocated by kstrdup should be freed.

CC: Brian Swetland <swetland@google.com>
Signed-off-by: Seunghun Lee <waydi1@gmail.com>
---
 drivers/staging/android/logger.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index 9b47e66..0bf0d24 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -790,7 +790,7 @@ static int __init create_log(char *log_name, int size)
 	if (unlikely(ret)) {
 		pr_err("failed to register misc device for log '%s'!\n",
 				log->misc.name);
-		goto out_free_log;
+		goto out_free_misc_name;
 	}
 
 	pr_info("created %luK log '%s'\n",
@@ -798,6 +798,9 @@ static int __init create_log(char *log_name, int size)
 
 	return 0;
 
+out_free_misc_name:
+	kfree(log->misc.name);
+
 out_free_log:
 	kfree(log);
 
-- 
1.7.9.5


             reply	other threads:[~2014-08-13 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 17:02 Seunghun Lee [this message]
2014-08-13 17:28 ` [PATCH] staging: android: fix a possible memory leak Dan Carpenter

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=1407949368-2791-1-git-send-email-waydi1@gmail.com \
    --to=waydi1@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gerb.stralko@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swetland@google.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