Memory leak when using Statement.expanded_sql (#553)

Memory leak when using Statement.expanded_sql
This commit is contained in:
gwenn
2019-07-28 08:53:26 +02:00
committed by GitHub
parent d87a1bbf7e
commit 4db226c0df
2 changed files with 17 additions and 13 deletions

View File

@@ -114,15 +114,14 @@ impl RawStatement {
unsafe { ffi::sqlite3_stmt_readonly(self.0) != 0 }
}
/// `CStr` must be freed
#[cfg(feature = "bundled")]
pub fn expanded_sql(&self) -> Option<&CStr> {
unsafe {
let ptr = ffi::sqlite3_expanded_sql(self.0);
if ptr.is_null() {
None
} else {
Some(CStr::from_ptr(ptr))
}
pub unsafe fn expanded_sql(&self) -> Option<&CStr> {
let ptr = ffi::sqlite3_expanded_sql(self.0);
if ptr.is_null() {
None
} else {
Some(CStr::from_ptr(ptr))
}
}