summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-30 16:26:30 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-30 16:26:30 +0200
commit246750ffa1b26335df4e485b4e4d28d83756ac43 (patch)
tree8c28306f1b66bd89713c9dfe8738097d56056d06 /kernel
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/joern/logfs (diff)
parentCRED: Fix memory leak in error handling (diff)
downloadlinux-246750ffa1b26335df4e485b4e4d28d83756ac43.tar.xz
linux-246750ffa1b26335df4e485b4e4d28d83756ac43.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/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
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cred.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/cred.c b/kernel/cred.c
index 1ed8ca18790c..1b1129d0cce8 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -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);
@@ -397,6 +397,10 @@ struct cred *prepare_usermodehelper_creds(void)
error:
put_cred(new);
+free_tgcred:
+#ifdef CONFIG_KEYS
+ kfree(tgcred);
+#endif
return NULL;
}