From 2e4343402ebf9241f1ba698a32d5b2a305032aaf Mon Sep 17 00:00:00 2001 From: PThorpe92 Date: Sat, 24 May 2025 15:20:09 -0400 Subject: [PATCH] Add null checks to prevent double frees in vtab connections --- extensions/core/src/vtabs.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extensions/core/src/vtabs.rs b/extensions/core/src/vtabs.rs index 74bc1ac29..6ae867dd6 100644 --- a/extensions/core/src/vtabs.rs +++ b/extensions/core/src/vtabs.rs @@ -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) }; }