Skip to content

Commit

Permalink
Merge pull request #206 from proflim/sungsu-dev
Browse files Browse the repository at this point in the history
fix disk leakage
  • Loading branch information
jiaaro authored Aug 29, 2017
2 parents 098f6c9 + 57bc79e commit 908c2e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ Mike Mattozzi

Marcio Mazza
github: marciomazza

Sungsu Lim
github: proflim
13 changes: 7 additions & 6 deletions pydub/audio_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,12 +508,13 @@ def is_format(f):
if p.returncode != 0:
raise CouldntDecodeError("Decoding failed. ffmpeg returned error code: {0}\n\nOutput from ffmpeg/avlib:\n\n{1}".format(p.returncode, p_err))

obj = cls._from_safe_wav(output)

input_file.close()
output.close()
os.unlink(input_file.name)
os.unlink(output.name)
try:
obj = cls._from_safe_wav(output)
finally:
input_file.close()
output.close()
os.unlink(input_file.name)
os.unlink(output.name)

return obj

Expand Down

0 comments on commit 908c2e2

Please sign in to comment.