Skip to contentSkip to conversation

staging: android: fix a possible memory leak

PATCH In review Seunghun Lee 2 participants 2 messages Aug 13, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: android: fix a possible memory leak

Memory allocated by kstrdup should be freed.

CC Brian Swetland <[email protected]>
---
 drivers/staging/android/logger.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/android/logger.c +4 -1
index 9b47e66..0bf0d24 100644
@@ -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);
 
Signature · 1 line
1.7.9.5