From b9ccb6fbdd4c5b009fa1e0b24af47625a8090d23 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 21 Oct 2024 21:19:22 -0400 Subject: Stop leaking named type references in rust --- rust/src/types.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'rust/src') 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 { 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)) } } -- cgit v1.3.1