Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jmorris/security-testing-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
  CRED: Fix memory leak in error handling
  • Loading branch information
torvalds committed Mar 30, 2010
2 parents 4660d3d + 570b8fb commit 246750f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kernel/cred.c
Expand Up @@ -364,7 +364,7 @@ struct cred *prepare_usermodehelper_creds(void)

new = kmem_cache_alloc(cred_jar, GFP_ATOMIC);
if (!new)
return NULL;
goto free_tgcred;

kdebug("prepare_usermodehelper_creds() alloc %p", new);

Expand Down Expand Up @@ -397,6 +397,10 @@ struct cred *prepare_usermodehelper_creds(void)

error:
put_cred(new);
free_tgcred:
#ifdef CONFIG_KEYS
kfree(tgcred);
#endif
return NULL;
}

Expand Down

0 comments on commit 246750f

Please sign in to comment.