Skip to content

Commit

Permalink
Avoid calling fclose with NULL file in Sequence.write and `MSA.…
Browse files Browse the repository at this point in the history
…write`
  • Loading branch information
althonos committed Jun 6, 2024
1 parent 8b41a59 commit 9839c8c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pyhmmer/easel.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3402,7 +3402,8 @@ cdef class MSA:
file = fopen_obj(fh, "w")
status = libeasel.msafile.esl_msafile_Write(file, self._msa, fmt)
finally:
fclose(file)
if file is not NULL:
fclose(file)

if status != libeasel.eslOK:
_reraise_error()
Expand Down Expand Up @@ -4713,7 +4714,8 @@ cdef class Sequence:
file = fopen_obj(fh, "w")
status = libeasel.sqio.ascii.esl_sqascii_WriteFasta(file, self._sq, False)
finally:
fclose(file)
if file is not NULL:
fclose(file)
if status != libeasel.eslOK:
raise UnexpectedError(status, "esl_sqascii_WriteFasta")

Expand Down

0 comments on commit 9839c8c

Please sign in to comment.