提交 85d6b09d 编写于 作者: M Matt Caswell

Fix mem leak on error path

The mem pointed to by cAB can be leaked on an error path.
Reviewed-by: NTim Hudson <tjh@openssl.org>
上级 c72b8e06
......@@ -84,7 +84,7 @@ BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N)
|| !EVP_DigestUpdate(ctxt, cAB + BN_bn2bin(A, cAB + longN), longN)
|| !EVP_DigestUpdate(ctxt, cAB + BN_bn2bin(B, cAB + longN), longN))
goto err;
OPENSSL_free(cAB);
if (!EVP_DigestFinal_ex(ctxt, cu, NULL))
goto err;
......@@ -94,7 +94,9 @@ BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N)
BN_free(u);
u = NULL;
}
err:
OPENSSL_free(cAB);
EVP_MD_CTX_free(ctxt);
return u;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册