From 3fd8093b41e745448ffeb0a0d3becc2cd1f9d7ad Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Tue, 10 Jul 2018 09:22:52 -0500 Subject: [PATCH] crypto: dh - fix memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In case memory resources for *base* were allocated, release them before return. Addresses-Coverity-ID: 1471702 ("Resource leak") Fixes: e3fe0ae12962 ("crypto: dh - add public key verification test") Signed-off-by: Gustavo A. R. Silva Reviewed-by: Stephan Müller Signed-off-by: Herbert Xu --- crypto/dh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/dh.c b/crypto/dh.c index 8f79269db2b7..09a44de4209d 100644 --- a/crypto/dh.c +++ b/crypto/dh.c @@ -174,7 +174,7 @@ static int dh_compute_value(struct kpp_request *req) } ret = dh_is_pubkey_valid(ctx, base); if (ret) - goto err_free_val; + goto err_free_base; } else { base = ctx->g; } -- 2.30.2