diff options
author | Darren Jenkins <darrenrjenkins@gmailcom> | 2008-07-08 15:51:44 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-07-08 15:51:44 +0800 |
commit | dbb018cd8a0fd073eaabf9de5a93f62d98bd7723 (patch) | |
tree | 761c76f1fc6c81a51cd68adfe77108bed3c66dfd /crypto | |
parent | 7b51ba38d9baca207152d1c97ec793cfb673a6cd (diff) | |
download | kernel_goldelico_gta04-dbb018cd8a0fd073eaabf9de5a93f62d98bd7723.zip kernel_goldelico_gta04-dbb018cd8a0fd073eaabf9de5a93f62d98bd7723.tar.gz kernel_goldelico_gta04-dbb018cd8a0fd073eaabf9de5a93f62d98bd7723.tar.bz2 |
crypto: tcrypt - Fix memory leak in test_cipher
Coverity CID: 2306 & 2307 RESOURCE_LEAK
In the second for loop in test_cipher(), data is allocated space with
kzalloc() and is only ever freed in an error case.
Looking at this loop, data is written to this memory but nothing seems
to read from it.
So here is a patch removing the allocation, I think this is the right
fix.
Only compile tested.
Signed-off-by: Darren Jenkins <darrenrjenkins@gmailcom>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/tcrypt.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 6beabc5..e47f6e0 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -586,12 +586,6 @@ static void test_cipher(char *algo, int enc, j = 0; for (i = 0; i < tcount; i++) { - data = kzalloc(template[i].ilen, GFP_KERNEL); - if (!data) - continue; - - memcpy(data, template[i].input, template[i].ilen); - if (template[i].iv) memcpy(iv, template[i].iv, MAX_IVLEN); else @@ -613,10 +607,8 @@ static void test_cipher(char *algo, int enc, printk("setkey() failed flags=%x\n", crypto_ablkcipher_get_flags(tfm)); - if (!template[i].fail) { - kfree(data); + if (!template[i].fail) goto out; - } } temp = 0; |