Skip to content

Commit

Permalink
staging: android: fix a possible memory leak
Browse files Browse the repository at this point in the history
Memory allocated by kstrdup should be freed.

CC: Brian Swetland <swetland@google.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Seunghun Lee <waydi1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Seunghun Lee authored and Greg Kroah-Hartman committed Aug 17, 2014
1 parent 299ef8c commit eb29835
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/staging/android/logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,14 +790,17 @@ 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",
(unsigned long) log->size >> 10, log->misc.name);

return 0;

out_free_misc_name:
kfree(log->misc.name);

out_free_log:
kfree(log);

Expand Down

0 comments on commit eb29835

Please sign in to comment.