Use CRYPTO_free to free the result of BN_bn2bin.

This commit is contained in:
Chris Cole 2014-09-27 23:34:10 -04:00
parent 7235e03c95
commit 6bc8e1c560
1 changed files with 2 additions and 6 deletions

View File

@ -83,9 +83,7 @@ extern {
/* Conversion from/to string representation */
fn BN_bn2dec(a: *mut BIGNUM) -> *const c_char;
/*
fn OpenSSL_free(buf: *const c_char);
*/
fn CRYPTO_free(buf: *const c_char);
}
pub struct BigNum(*mut BIGNUM);
@ -441,9 +439,7 @@ impl BigNum {
assert!(!buf.is_null());
let c_str = CString::new(buf, false);
let str = c_str.as_str().unwrap().to_string();
/* XXX
OpenSSL_free(buf);
*/
CRYPTO_free(buf);
str
}
}