Commit 3fd8093b authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Herbert Xu

crypto: dh - fix memory leak

In case memory resources for *base* were allocated, release them
before return.

Addresses-Coverity-ID: 1471702 ("Resource leak")
Fixes: e3fe0ae1 ("crypto: dh - add public key verification test")
Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: default avatarStephan Müller <smueller@chronox.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d6be72ee
...@@ -174,7 +174,7 @@ static int dh_compute_value(struct kpp_request *req) ...@@ -174,7 +174,7 @@ static int dh_compute_value(struct kpp_request *req)
} }
ret = dh_is_pubkey_valid(ctx, base); ret = dh_is_pubkey_valid(ctx, base);
if (ret) if (ret)
goto err_free_val; goto err_free_base;
} else { } else {
base = ctx->g; base = ctx->g;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment