提交 679d8751 编写于 作者: D David Benjamin 提交者: Kurt Roeckx

Fix memory leak in DSA redo case.

Found by clang scan-build.
Signed-off-by: NKurt Roeckx <kurt@roeckx.be>
Reviewed-by: NRichard Levitte <levitte@openssl.org>

RT: #4184, MR: #1496
上级 91cf7551
......@@ -191,9 +191,6 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
if (!BN_mod_mul(s, s, kinv, dsa->q, ctx))
goto err;
ret = DSA_SIG_new();
if (ret == NULL)
goto err;
/*
* Redo if r or s is zero as required by FIPS 186-3: this is very
* unlikely.
......@@ -205,11 +202,14 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
}
goto redo;
}
ret = DSA_SIG_new();
if (ret == NULL)
goto err;
ret->r = r;
ret->s = s;
err:
if (!ret) {
if (ret == NULL) {
DSAerr(DSA_F_DSA_DO_SIGN, reason);
BN_free(r);
BN_free(s);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册