Fix memory leak in DSA redo case.
Found by clang scan-build. Signed-off-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Richard Levitte <levitte@openssl.org> RT: #4184, MR: #1496
This commit is contained in:
parent
91cf7551a1
commit
679d87515d
@ -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))
|
if (!BN_mod_mul(s, s, kinv, dsa->q, ctx))
|
||||||
goto err;
|
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
|
* Redo if r or s is zero as required by FIPS 186-3: this is very
|
||||||
* unlikely.
|
* unlikely.
|
||||||
@ -205,11 +202,14 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
|
|||||||
}
|
}
|
||||||
goto redo;
|
goto redo;
|
||||||
}
|
}
|
||||||
|
ret = DSA_SIG_new();
|
||||||
|
if (ret == NULL)
|
||||||
|
goto err;
|
||||||
ret->r = r;
|
ret->r = r;
|
||||||
ret->s = s;
|
ret->s = s;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (!ret) {
|
if (ret == NULL) {
|
||||||
DSAerr(DSA_F_DSA_DO_SIGN, reason);
|
DSAerr(DSA_F_DSA_DO_SIGN, reason);
|
||||||
BN_free(r);
|
BN_free(r);
|
||||||
BN_free(s);
|
BN_free(s);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user