crypto: lrw - fix memleak
Jussi Kivilinna [Tue, 18 Oct 2011 10:32:14 +0000 (13:32 +0300)]
LRW module leaks child cipher memory when init_tfm() fails because of child
block size not being 16.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

crypto/lrw.c

index 358f80b..fca3246 100644 (file)
@@ -220,6 +220,7 @@ static int init_tfm(struct crypto_tfm *tfm)
 
        if (crypto_cipher_blocksize(cipher) != 16) {
                *flags |= CRYPTO_TFM_RES_BAD_BLOCK_LEN;
+               crypto_free_cipher(cipher);
                return -EINVAL;
        }