Use kstring instead of POSIX 2008's strndup()
Use kstring instead of POSIX 2008's strndup()

Also write free(str.s) directly and use ks_release() where appropriate.

mcshane/samtools,mcshane/samtools,mcshane/samtools,mcshane/samtools,mcshane/samtools,mcshane/samtools