public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: android: fix a possible memory leak
@ 2014-08-13 17:02 Seunghun Lee
  2014-08-13 17:28 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Seunghun Lee @ 2014-08-13 17:02 UTC (permalink / raw)
  To: gregkh; +Cc: gerb.stralko, devel, linux-kernel, Seunghun Lee, Brian Swetland

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


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

end of thread, other threads:[~2014-08-13 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-13 17:02 [PATCH] staging: android: fix a possible memory leak Seunghun Lee
2014-08-13 17:28 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox