aboutsummaryrefslogtreecommitdiff
path: root/src/rust
diff options
context:
space:
mode:
Diffstat (limited to 'src/rust')
-rw-r--r--src/rust/protover/ffi.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs
index e3e545db75..f55b87acf6 100644
--- a/src/rust/protover/ffi.rs
+++ b/src/rust/protover/ffi.rs
@@ -65,12 +65,10 @@ pub extern "C" fn protover_all_supported(
if maybe_unsupported.is_some() {
let unsupported: UnvalidatedProtoEntry = maybe_unsupported.unwrap();
- let c_unsupported: CString = match CString::new(unsupported.to_string()) {
- Ok(n) => n,
- Err(_) => return 1,
- };
-
- let ptr = c_unsupported.into_raw();
+ if missing_out.is_null() {
+ return 0;
+ }
+ let ptr = allocate_and_copy_string(&unsupported.to_string());
unsafe { *missing_out = ptr };
return 0;