diff --git a/utils/check_sources.py b/utils/check_sources.py index 1b30f2dc5..8eeadbf4b 100755 --- a/utils/check_sources.py +++ b/utils/check_sources.py @@ -212,7 +212,10 @@ def main(argv): try: f = open(fn, 'r') - lines = list(f) + try: + lines = list(f) + finally: + f.close() except (IOError, OSError), err: print "%s: cannot open: %s" % (fn, err) num += 1