Rust: don't leak fd on load_trusted_setup_file() error (#402)
This commit is contained in:
parent
2ab0c219fc
commit
8758b27792
|
@ -193,6 +193,8 @@ impl KZGSettings {
|
|||
let mut kzg_settings = MaybeUninit::<KZGSettings>::uninit();
|
||||
let result = unsafe {
|
||||
let res = load_trusted_setup_file(kzg_settings.as_mut_ptr(), file_ptr);
|
||||
let _unchecked_close_result = libc::fclose(file_ptr);
|
||||
|
||||
if let C_KZG_RET::C_KZG_OK = res {
|
||||
Ok(kzg_settings.assume_init())
|
||||
} else {
|
||||
|
@ -202,9 +204,6 @@ impl KZGSettings {
|
|||
}
|
||||
};
|
||||
|
||||
// We don't really care if this fails.
|
||||
let _unchecked_close_result = unsafe { libc::fclose(file_ptr) };
|
||||
|
||||
result
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue