Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/lib_ccx/lib_ccx.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "ccx_decoders_isdb.h"

struct ccx_common_logging_t ccx_common_logging;
extern void free_rust_c_string_array(char **arr, size_t count);
static struct ccx_decoders_common_settings_t *init_decoder_setting(
struct ccx_s_options *opt)
{
Expand Down Expand Up @@ -272,9 +273,11 @@ void dinit_libraries(struct lib_ccx_ctx **ctx)
freep(&ccx_options.enc_cfg.output_filename);
freep(&lctx->basefilename);
freep(&lctx->pesheaderbuf);
for (i = 0; i < lctx->num_input_files; i++)
freep(&lctx->inputfile[i]);
freep(&lctx->inputfile);
if (lctx->inputfile)
{
free_rust_c_string_array(lctx->inputfile, lctx->num_input_files);
lctx->inputfile = NULL;
}
freep(ctx);
}

Expand Down
3 changes: 2 additions & 1 deletion src/rust/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ pub fn string_to_c_chars(strs: Vec<String>) -> *mut *mut c_char {
/// # Safety
/// The pointers must have been allocated by `string_to_c_chars` or be null.
/// `count` must be the number of strings in the array.
pub unsafe fn free_rust_c_string_array(arr: *mut *mut c_char, count: usize) {
#[no_mangle]
pub unsafe extern "C" fn free_rust_c_string_array(arr: *mut *mut c_char, count: usize) {
if arr.is_null() {
return;
}
Expand Down
Loading