Commit 3c257391 authored by David Greenberg's avatar David Greenberg

Free err strings correctly

parent 8796fd89
...@@ -163,8 +163,11 @@ pub trait Writable { ...@@ -163,8 +163,11 @@ pub trait Writable {
fn error_message(ptr: *const i8) -> String { fn error_message(ptr: *const i8) -> String {
let c_str = unsafe { CStr::from_ptr(ptr) }; let c_str = unsafe { CStr::from_ptr(ptr) };
//TODO I think we're leaking the c string here; should be a call to free once realloced into rust String let s = from_utf8(c_str.to_bytes()).unwrap().to_owned();
from_utf8(c_str.to_bytes()).unwrap().to_owned() unsafe{
libc::free(ptr as *mut libc::c_void);
}
s
} }
impl RocksDB { impl RocksDB {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment