Skip to content

Commit

Permalink
Do not use bam_get_read_seq due to memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
pjb7687 committed Jul 7, 2016
1 parent a245472 commit cd35d6f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions hts/bam.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,8 @@ def rlen(self):
@property
def seq(self):
"""Nucleotide sequence of read."""
kstr = ffi.new('kstring_t *', {'m': 0, 'l': 0, 's': ffi.NULL})
r = libhts.bam_get_read_seq(self._b, kstr)
assert r == kstr.l, (r, kstr.l)
return ffi.string(kstr.s)
seq_uint8_ptr = libhts.bam_get_seq(self._b)
return ''.join("=ACMGRSVTWYHKDBN"[libhts.bam_seqi(seq_uint8_ptr, i)] for i in range(self._b.core.l_qseq))

@property
def flag_str(self):
Expand Down

0 comments on commit cd35d6f

Please sign in to comment.