fix memory leaks due to my erroneous use of c_str::unwrap() which gives up all ownership. Replace with c_str::with_ref which does the right thing.