Skip to content

Commit

Permalink
Merge pull request TheDan64#84 from cdisselkoen/memorybuffer-create_f…
Browse files Browse the repository at this point in the history
…rom_file-bugfix

bugfix: use CString when passing path across FFI
  • Loading branch information
TheDan64 authored Jun 20, 2019
2 parents a326bd6 + 781731b commit 712793e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/memory_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl MemoryBuffer {
}

pub fn create_from_file(path: &Path) -> Result<Self, LLVMString> {
let path = path.to_str().expect("Did not find a valid Unicode path string");
let path = CString::new(path.to_str().expect("Did not find a valid Unicode path string")).expect("Failed to convert to CString");
let mut memory_buffer = ptr::null_mut();
let mut err_string = unsafe { zeroed() };

Expand Down

0 comments on commit 712793e

Please sign in to comment.