From 48b7def004f11b384bacbdd114bb7a3d2d5c5bd4 Mon Sep 17 00:00:00 2001 From: Sudo-Ivan Date: Sat, 3 Jan 2026 21:36:47 -0600 Subject: [PATCH] fix(schema.py): ensure cursor is closed after executing PRAGMA table_info to prevent resource leaks --- meshchatx/src/backend/database/schema.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/meshchatx/src/backend/database/schema.py b/meshchatx/src/backend/database/schema.py index 013ac1f..a53b398 100644 --- a/meshchatx/src/backend/database/schema.py +++ b/meshchatx/src/backend/database/schema.py @@ -19,8 +19,11 @@ class DatabaseSchema: """Add a column to a table if it doesn't exist.""" # First check if it exists using PRAGMA cursor = self.provider.connection.cursor() - cursor.execute(f"PRAGMA table_info({table_name})") - columns = [row[1] for row in cursor.fetchall()] + try: + cursor.execute(f"PRAGMA table_info({table_name})") + columns = [row[1] for row in cursor.fetchall()] + finally: + cursor.close() if column_name not in columns: try: