Free r and s on ECDSA_SIG before overwriting them in ECDSA_SIG_set0

This commit is contained in:
Thomas Whiteway 2019-09-06 09:53:58 +01:00
parent dbe0672dc4
commit 106d613805
1 changed files with 7 additions and 2 deletions

View File

@ -138,6 +138,11 @@ cfg_if! {
r: *mut ffi::BIGNUM, r: *mut ffi::BIGNUM,
s: *mut ffi::BIGNUM, s: *mut ffi::BIGNUM,
) -> c_int { ) -> c_int {
if r.is_null() || s.is_null() {
return 0;
}
ffi::BN_clear_free((*sig).r);
ffi::BN_clear_free((*sig).s);
(*sig).r = r; (*sig).r = r;
(*sig).s = s; (*sig).s = s;
1 1