diff --git a/lib/utils/hashdb.py b/lib/utils/hashdb.py index 20efcef3c..166add957 100644 --- a/lib/utils/hashdb.py +++ b/lib/utils/hashdb.py @@ -30,12 +30,13 @@ class HashDB(object): cursor = property(_get_cursor) - def __del__(self): - self.close() - def close(self): + threadData = getCurrentThreadData() try: - self.cursor.connection.close() + if threadData.hashDBCursor: + threadData.hashDBCursor.close() + threadData.hashDBCursor.connection.close() + threadData.hashDBCursor = None except: pass