convert: fix a file descriptor leak
authorMatt Harbison <matt_harbison@yahoo.com>
Tue, 25 Sep 2018 22:46:18 -0400
changeset 39833 28626957395a
parent 39832 85a474adaf26
child 39834 d1e0b905c59d
convert: fix a file descriptor leak test-check-code flagged this after I changed this line for something unrelated.
hgext/convert/gnuarch.py
--- a/hgext/convert/gnuarch.py	Wed Sep 26 20:33:09 2018 +0900
+++ b/hgext/convert/gnuarch.py	Tue Sep 25 22:46:18 2018 -0400
@@ -18,6 +18,7 @@
     encoding,
     error,
     pycompat,
+    util,
 )
 from mercurial.utils import (
     dateutil,
@@ -228,7 +229,7 @@
             else:
                 mode = ''
         else:
-            data = open(os.path.join(self.tmppath, name), 'rb').read()
+            data = util.readfile(os.path.join(self.tmppath, name))
             mode = (mode & 0o111) and 'x' or ''
         return data, mode