mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-22 00:15:20 +01:00
Add null checks to prevent double frees in vtab connections
This commit is contained in:
@@ -516,6 +516,9 @@ impl Statement {
|
||||
|
||||
/// Close the statement
|
||||
pub fn close(&self) {
|
||||
if self._ctx.is_null() {
|
||||
return;
|
||||
}
|
||||
unsafe { (*self._ctx).close() }
|
||||
}
|
||||
}
|
||||
@@ -566,6 +569,10 @@ impl Stmt {
|
||||
|
||||
/// Close the statement
|
||||
pub fn close(&self) {
|
||||
// null check to prevent double free
|
||||
if self._ctx.is_null() {
|
||||
return;
|
||||
}
|
||||
unsafe { (self._close)(self as *const Stmt as *mut Stmt) };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user