diff options
| author | Mason Reed <mason@vector35.com> | 2024-10-21 21:19:22 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2024-10-21 21:20:36 -0400 |
| commit | b9ccb6fbdd4c5b009fa1e0b24af47625a8090d23 (patch) | |
| tree | f6c2dd1548bc92c4e5fc5d84e16eca87d78e7c0b /rust/src/types.rs | |
| parent | 344774a604b3643f3518aadf006970949a1e57dd (diff) | |
Stop leaking named type references in rust
Diffstat (limited to 'rust/src/types.rs')
| -rw-r--r-- | rust/src/types.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/rust/src/types.rs b/rust/src/types.rs index 1c8071e8..a39d650c 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -2326,9 +2326,7 @@ impl NamedTypeReference { /// the core will do the id stuff for you. pub fn new(type_class: NamedTypeReferenceClass, mut name: QualifiedName) -> Ref<Self> { unsafe { - RefCountable::inc_ref(&Self { - handle: BNCreateNamedType(type_class, ptr::null() as *const _, &mut name.0), - }) + Self::ref_from_raw(BNCreateNamedType(type_class, ptr::null() as *const _, &mut name.0)) } } @@ -2345,9 +2343,7 @@ impl NamedTypeReference { let type_id = type_id.into_bytes_with_nul(); unsafe { - RefCountable::inc_ref(&Self { - handle: BNCreateNamedType(type_class, type_id.as_ref().as_ptr() as _, &mut name.0), - }) + Self::ref_from_raw(BNCreateNamedType(type_class, type_id.as_ref().as_ptr() as _, &mut name.0)) } } |
