crypto: tcrypt - Fix leak of struct aead_request in test_aead_speed()
authorChristian Engelmayer <cengelma@gmx.at>
Mon, 21 Apr 2014 18:47:05 +0000 (20:47 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 28 Apr 2014 10:21:18 +0000 (18:21 +0800)
Fix leakage of memory for struct aead_request that is allocated via
aead_request_alloc() but not released via aead_request_free().
Reported by Coverity - CID 1163869.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/tcrypt.c

index 18491552b83a061c2a40b1dcea188126da99a413..09c93ff216e41df6ba89b9d9c9b51fc8f46e8033 100644 (file)
@@ -320,7 +320,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
        if (!req) {
                pr_err("alg: aead: Failed to allocate request for %s\n",
                       algo);
-               goto out;
+               goto out_noreq;
        }
 
        i = 0;
@@ -390,6 +390,8 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
        } while (*keysize);
 
 out:
+       aead_request_free(req);
+out_noreq:
        crypto_free_aead(tfm);
 out_notfm:
        kfree(sg);