[snapshot/master] Fix potential but unlikely db handle leak
---
web/app/snapshot/controllers/root.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/web/app/snapshot/controllers/root.py b/web/app/snapshot/controllers/root.py
index 44a4196..1737ebe 100644
--- a/web/app/snapshot/controllers/root.py
+++ b/web/app/snapshot/controllers/root.py
@@ -12,14 +12,15 @@ log = logging.getLogger(__name__)
class RootController(BaseController):
def index(self):
- db = DBInstance(g.pool)
+ db = None
try:
+ db = DBInstance(g.pool)
c.names = link_quote_array(g.shm.archives_get_list(db))
c.srcstarts = link_quote_array(g.shm.packages_get_name_starts(db))
set_expires(int(config['app_conf']['expires.root']))
return render('/root.mako')
finally:
- db.close()
+ if not db is None: db.close()
def _build_crumbs(self, page=None):
--
1.5.6.5
Reply to: