Skip to content

Commit 0a65c3d

Browse files
rhermanklinkdpgeorge
authored andcommitted
unix-ffi/sqlite3: Fix statements not being finalized.
Currently, statements are only finalized upon a call to Cursor.close(). However, in Cursor.execute() new statements get created without the previous statements being finalized, causing those to get leaked, preventing the database from being closed. The fix addresses this by finalizing the previous statement if it exists. Signed-off-by: Robert Klink <rhermanklink@ripe.net>
1 parent 8d6ebf5 commit 0a65c3d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

unix-ffi/sqlite3/sqlite3.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ def __init__(self, h):
8484
self.stmnt = None
8585

8686
def execute(self, sql, params=None):
87+
if self.stmnt:
88+
# If there is an existing statement, finalize that to free it
89+
res = sqlite3_finalize(self.stmnt)
90+
check_error(self.h, res)
91+
8792
if params:
8893
params = [quote(v) for v in params]
8994
sql = sql % tuple(params)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy