summaryrefslogtreecommitdiff
path: root/rust/src/debuginfo.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-04 15:38:54 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commite180c955f9397849bdb1ea08f1e913ebac71ed5d (patch)
treea6c8e309e3a723c04e2d5085c0449bd8f3a10db5 /rust/src/debuginfo.rs
parentbb68ef5ad6c3e6a391bc884763231ed3291a5f9e (diff)
[Rust] More cleanup
Diffstat (limited to 'rust/src/debuginfo.rs')
-rw-r--r--rust/src/debuginfo.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/rust/src/debuginfo.rs b/rust/src/debuginfo.rs
index bafa9cc4..c4bc7add 100644
--- a/rust/src/debuginfo.rs
+++ b/rust/src/debuginfo.rs
@@ -807,15 +807,8 @@ impl DebugInfo {
}
for local_variable in &new_func.local_variables {
- local_variables_array.push(BNVariableNameAndType {
- var: local_variable.variable.into(),
- autoDefined: local_variable.auto_defined,
- typeConfidence: local_variable.ty.confidence,
- name: BNAllocString(
- local_variable.name.clone().into_bytes_with_nul().as_ptr() as _
- ),
- type_: local_variable.ty.contents.handle,
- });
+ // NOTE: must be manually freed after call to BNAddDebugFunction is over.
+ local_variables_array.push(NamedVariableWithType::into_raw(local_variable.clone()));
}
let result = BNAddDebugFunction(
@@ -841,11 +834,11 @@ impl DebugInfo {
);
for i in components_array {
- BNFreeString(i);
+ BnString::free_raw(i);
}
for i in &local_variables_array {
- BNFreeString(i.name);
+ NamedVariableWithType::free_raw(*i);
}
result
}