crypto: dh - fix memory leak

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

Addresses-Coverity-ID: 1471702 ("Resource leak")
Fixes: e3fe0ae129 ("crypto: dh - add public key verification test")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Stephan Müller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Gustavo A. R. Silva 2018-07-10 09:22:52 -05:00 committed by Herbert Xu
parent d6be72ee2c
commit 3fd8093b41

View File

@ -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;
}