summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorLuke Diamand <luke@diamand.org>2020-01-30 11:50:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-01-30 20:21:13 (GMT)
commit43f33e492af65d008045ee0695d0f17434e8c3c9 (patch)
tree50486bc803650cc2374e5d7782505ed0613d33db /git-p4.py
parent19fa5ac333134fc3aa1e462780c4690177474ade (diff)
downloadgit-43f33e492af65d008045ee0695d0f17434e8c3c9.zip
git-43f33e492af65d008045ee0695d0f17434e8c3c9.tar.gz
git-43f33e492af65d008045ee0695d0f17434e8c3c9.tar.bz2
git-p4: avoid leak of file handle when cloning
Spotted by Eric Sunshine: https://public-inbox.org/git/CAPig+cRx3hG64nuDie69o_gdX39F=sR6D8LyA7J1rCErgu0aMA@mail.gmail.com/ Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/git-p4.py b/git-p4.py
index eb5bc28..9a71a66 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -3563,7 +3563,8 @@ class P4Sync(Command, P4UserMap):
changes = []
if len(self.changesFile) > 0:
- output = open(self.changesFile).readlines()
+ with open(self.changesFile) as f:
+ output = f.readlines()
changeSet = set()
for line in output:
changeSet.add(int(line))