Kaydet (Commit) 2d1f0924 authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

Issue #20244: Fixed possible file leaks when unexpected error raised in

tarfile open functions.
......@@ -1647,6 +1647,9 @@ class TarFile(object):
if mode == 'r':
raise ReadError("not a bzip2 file")
raise
except:
fileobj.close()
raise
t._extfileobj = False
return t
......@@ -1672,6 +1675,9 @@ class TarFile(object):
if mode == 'r':
raise ReadError("not an lzma file")
raise
except:
fileobj.close()
raise
t._extfileobj = False
return t
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment