dragonfly: Fix a memory leak on error path
This is mostly a theoretical case, but since crypto_bignum_rand() could fail, need to free the allocated struct crypto_bignum *tmp in such a case. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
8925d2010d
commit
677e120181
1 changed files with 3 additions and 1 deletions
|
@ -40,8 +40,10 @@ int dragonfly_get_random_qr_qnr(const struct crypto_bignum *prime,
|
|||
int res;
|
||||
|
||||
tmp = crypto_bignum_init();
|
||||
if (!tmp || crypto_bignum_rand(tmp, prime) < 0)
|
||||
if (!tmp || crypto_bignum_rand(tmp, prime) < 0) {
|
||||
crypto_bignum_deinit(tmp, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
res = crypto_bignum_legendre(tmp, prime);
|
||||
if (res == 1 && !(*qr))
|
||||
|
|
Loading…
Reference in a new issue