From cf0b54e63c1d1dd7342cb5cc1049c267ad7a6b10 Mon Sep 17 00:00:00 2001 From: graphenn Date: Sun, 10 Dec 2023 03:16:32 +0800 Subject: [PATCH] fix core dump after seg vcf write --- cyvcf2/cyvcf2.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyvcf2/cyvcf2.pyx b/cyvcf2/cyvcf2.pyx index 7ff79f0..6fc695c 100644 --- a/cyvcf2/cyvcf2.pyx +++ b/cyvcf2/cyvcf2.pyx @@ -2404,7 +2404,7 @@ cdef class Writer(VCF): if not self.header_written: self.write_header() if var.b.errcode == BCF_ERR_CTG_UNDEF: - h = bcf_hdr_id2hrec(self.ohdr, BCF_DT_CTG, 0, var.b.rid) + h = bcf_hdr_id2hrec(bcf_hdr_dup(self.ohdr), BCF_DT_CTG, 0, var.b.rid) if h == NULL: raise Exception("contig %d unknown and not found in header" % var.b.rid) if bcf_hdr_add_hrec(self.hdr, h) < 0: