diff options
| author | Rubens Brandao <git@rubens.io> | 2024-04-17 09:53:45 -0300 |
|---|---|---|
| committer | Rubens Brandao <git@rubens.io> | 2024-04-17 09:53:45 -0300 |
| commit | 3e444f221b4dfc37497342686732ba10dbcfa567 (patch) | |
| tree | 68decd24b1cb5b1a14399a0d9cd2957ca2335f82 /rust/src | |
| parent | f408eb32085956f7e29e0f15fd92aa4b72453370 (diff) | |
fix leak creation of invalid BinaryView handle
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/interaction.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/rust/src/interaction.rs b/rust/src/interaction.rs index ccb5c81a..76fc9275 100644 --- a/rust/src/interaction.rs +++ b/rust/src/interaction.rs @@ -296,7 +296,9 @@ impl FormInputBuilder { result.type_ = BNFormInputFieldType::AddressFormField; result.prompt = prompt.as_ref().as_ptr() as *const c_char; if let Some(view) = view { - result.view = view.handle; + // the view is being moved into result, there is no need to clone + // and drop is intentionally being avoided with `Ref::into_raw` + result.view = unsafe { Ref::into_raw(view) }.handle; } result.currentAddress = current_address.unwrap_or(0); result.hasDefault = default.is_some(); |
