diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 4f65b2c..e369873 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -3,7 +3,7 @@ name: Linux on: push: - branches: [ main, dev ] + branches: [ main, doc ] pull_request: branches: [ main ] @@ -35,5 +35,6 @@ jobs: run: | cd test make + export ASAN_OPTIONS=alloc_dealloc_mismatch=0 make test # find . -name "*.bin" -exec '{}' --success ';' diff --git a/test/Makefile b/test/Makefile index f5e598f..1f4fa9d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,6 +1,7 @@ # detect OS architecture and add flags CXX = g++ -CXXFLAGS = -std=c++11 -g -Wall -fsanitize=address +# CXXFLAGS = -std=c++11 -Wall -g -fsanitize=address +CXXFLAGS = -std=c++11 -Wall HTSINC = /usr/local/include HTSLIB = /usr/local/lib LDFLAGS = -L$(HTSLIB) -Wl,-rpath,$(HTSLIB) diff --git a/vcfpp.h b/vcfpp.h index 7fffd12..5fbbc26 100644 --- a/vcfpp.h +++ b/vcfpp.h @@ -1460,7 +1460,6 @@ class BcfWriter std::shared_ptr fp; // hts file std::shared_ptr b = std::shared_ptr(bcf_init(), variant_close()); // variant int ret; - kstring_t s = {0, 0, NULL}; // kstring bool isHeaderWritten = false; public: @@ -1579,11 +1578,9 @@ class BcfWriter void writeLine(const std::string & vcfline) { if(!isHeaderWritten && !writeHeader()) throw std::runtime_error("could not write header\n"); - std::vector line(vcfline.begin(), vcfline.end()); - line.push_back('\0'); // don't forget string has no \0; - s.s = &line[0]; - s.l = vcfline.length(); - s.m = vcfline.length(); + std::vector str(vcfline.begin(), vcfline.end()); + str.push_back('\0'); // don't forget string has no \0; + kstring_t s = {vcfline.length(), vcfline.length(), &str[0]}; // kstring ret = vcf_parse(&s, header.hdr, b.get()); if(ret > 0) throw std::runtime_error("error parsing: " + vcfline + "\n"); if(b->errcode == BCF_ERR_CTG_UNDEF)