From: Christian Engelmayer Date: Mon, 21 Apr 2014 18:47:05 +0000 (+0200) Subject: crypto: tcrypt - Fix leak of struct aead_request in test_aead_speed() X-Git-Tag: v4.14-rc1~7438^2~2^2~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6af1f93e2a0192fb1efbe82a5fef53d71cbe218b;p=platform%2Fkernel%2Flinux-rpi.git crypto: tcrypt - Fix leak of struct aead_request in test_aead_speed() 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 Reviewed-by: Marek Vasut Acked-by: Tim Chen Signed-off-by: Herbert Xu --- diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 1849155..09c93ff2 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -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);