Skip to content

Commit

Permalink
Valgrind fix
Browse files Browse the repository at this point in the history
  • Loading branch information
erer1243 committed Jan 9, 2025
1 parent f1d3748 commit 36ffe29
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/swss-common/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,14 @@ pub(crate) unsafe fn take_key_op_field_values_array(kfvs: SWSSKeyOpFieldValuesAr

/// Takes ownership of an `SWSSStringArray` and turns it into a native representation.
pub(crate) unsafe fn take_string_array(arr: SWSSStringArray) -> Vec<String> {
if !arr.data.is_null() {
let out = if !arr.data.is_null() {
let entries = slice::from_raw_parts(arr.data, arr.len as usize);
Vec::from_iter(entries.iter().map(|&s| take_cstr(s)))
} else {
Vec::new()
}
};
SWSSStringArray_free(arr);
out
}

pub(crate) fn make_field_value_array<I, F, V>(fvs: I) -> (SWSSFieldValueArray, KeepAlive)
Expand Down

0 comments on commit 36ffe29

Please sign in to comment.