Module: kamailio Branch: 5.3 Commit: e26e587f31eb23c431a2cfb149ec7a86b4f648bc URL: https://github.com/kamailio/kamailio/commit/e26e587f31eb23c431a2cfb149ec7a86...
Author: Victor Seva linuxmaniac@torreviejawireless.org Committer: Victor Seva linuxmaniac@torreviejawireless.org Date: 2020-05-04T17:01:53+02:00
utils/kamctl: dbtextdb.py close previous opened file properly
related #1747
(cherry picked from commit 5f52f9905bbdf63d636080f7d0340af4f71ed12a)
---
Modified: utils/kamctl/dbtextdb/dbtextdb.py
---
Diff: https://github.com/kamailio/kamailio/commit/e26e587f31eb23c431a2cfb149ec7a86... Patch: https://github.com/kamailio/kamailio/commit/e26e587f31eb23c431a2cfb149ec7a86...
---
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.