Module: kamailio
Branch: master
Commit: 5f52f9905bbdf63d636080f7d0340af4f71ed12a
URL:
https://github.com/kamailio/kamailio/commit/5f52f9905bbdf63d636080f7d0340af…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2020-05-04T15:22:36+02:00
utils/kamctl: dbtextdb.py close previous opened file properly
related #1747
---
Modified: utils/kamctl/dbtextdb/dbtextdb.py
---
Diff:
https://github.com/kamailio/kamailio/commit/5f52f9905bbdf63d636080f7d0340af…
Patch:
https://github.com/kamailio/kamailio/commit/5f52f9905bbdf63d636080f7d0340af…
---
diff --git a/utils/kamctl/dbtextdb/dbtextdb.py b/utils/kamctl/dbtextdb/dbtextdb.py
index 7e1de04687..581496c309 100755
--- a/utils/kamctl/dbtextdb/dbtextdb.py
+++ b/utils/kamctl/dbtextdb/dbtextdb.py
@@ -60,6 +60,10 @@ def __init__(self, location):
if not os.path.isdir(location):
raise ParseError(location + ' is not a directory')
+ def __del__(self):
+ if getattr(self, 'fd', False):
+ self.fd.close()
+
def _ParseOrderBy(self):
"""Parse out the column name to be used for ordering the dataset.
@@ -438,6 +442,8 @@ def CleanUp(self):
self.command = '' # which command are we executing
self.strings = [] # list of string literals parsed from the query
self.parens = [] # list of parentheses parsed from the query
+ if getattr(self, 'fd', False):
+ self.fd.close()
def ParseQuery(self, query):
"""External wrapper for the query parsing routines.