Skip to content

Commit

Permalink
Merge pull request #71 from aertslab/fix_file_descriptor_leak
Browse files Browse the repository at this point in the history
Close file descriptors for temporary files after creating them with mkstemp(). -- by ghuls
  • Loading branch information
taoliu committed Mar 13, 2015
2 parents ee79249 + 1e0722e commit 3508d31
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MACS2/IO/CallPeakUnit.pyx
Expand Up @@ -467,9 +467,13 @@ cdef class CallerFromAlignments:
f.close()
return
except IOError:
self.pileup_data_files[ chrom ] = mkstemp()[1]
temp_fd, temp_filename = mkstemp()
os.close(temp_fd)
self.pileup_data_files[ chrom ] = temp_filename
else:
self.pileup_data_files[ chrom ] = mkstemp()[1]
temp_fd, temp_filename = mkstemp()
os.close(temp_fd)
self.pileup_data_files[ chrom ] = temp_filename

# reset or clean existing self.chr_pos_treat_ctrl
if self.chr_pos_treat_ctrl: # not a beautiful way to clean
Expand Down

0 comments on commit 3508d31

Please sign in to comment.