Skip to content

Commit

Permalink
crypto: dh - fix memory leak
Browse files Browse the repository at this point in the history
In case memory resources for *base* were allocated, release them
before return.

Addresses-Coverity-ID: 1471702 ("Resource leak")
Fixes: e3fe0ae ("crypto: dh - add public key verification test")
Signed-off-by: Gustavo A. R. Silva <[email protected]>
Reviewed-by: Stephan Müller <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
GustavoARSilva authored and herbertx committed Jul 20, 2018
1 parent d6be72e commit 3fd8093
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3fd8093

Please sign in to comment.