From 052a8d2adb0c7899ae875c03da4edf80b2fa1a81 Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Wed, 20 Sep 2023 14:40:22 -0400 Subject: Rust API : FFI Fix, was leaking some non-null-terminated strings to the core..fix passing a nullptr to `load` --- rust/src/metadata.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'rust/src/metadata.rs') diff --git a/rust/src/metadata.rs b/rust/src/metadata.rs index 1ea8225d..e29789e5 100644 --- a/rust/src/metadata.rs +++ b/rust/src/metadata.rs @@ -24,6 +24,10 @@ impl Metadata { Ref::new(Self::from_raw(handle)) } + pub fn new_of_type(metadata_type: MetadataType) -> Ref { + unsafe { Self::ref_from_raw(BNCreateMetadataOfType(metadata_type)) } + } + pub fn get_type(&self) -> MetadataType { unsafe { BNMetadataGetType(self.handle) } } -- cgit v1.3.1