3bcfa1a2a525a53353f2398c9844590d3e4669fc braney Tue Feb 2 08:23:20 2016 -0800 one more time! Close vcf file if read in at open time diff --git src/lib/vcf.c src/lib/vcf.c index 3f48d2d..cfbee9a 100644 --- src/lib/vcf.c +++ src/lib/vcf.c @@ -977,33 +977,33 @@ * seek to the position range and parse all lines in range into * vcff->records. If maxErr >= zero, then continue to parse until * there are maxErr+1 errors. A maxErr less than zero does not stop * and reports all errors. Set maxErr to VCF_IGNORE_ERRS for silence */ { struct lineFile *lf = lineFileTabixMayOpen(fileOrUrl, TRUE); if (lf == NULL) return NULL; struct vcfFile *vcff = vcfFileHeaderFromLineFile(lf, maxErr); if (vcff == NULL) return NULL; if (isNotEmpty(chrom) && start != end) { if (lineFileSetTabixRegion(lf, chrom, start, end)) vcff->records = vcfParseData(vcff, NULL, 0, 0, maxRecords); + lineFileClose(&(vcff->lf)); // file is all read in so we close it } -lineFileClose(&(vcff->lf)); // file is all read in so we close it return vcff; } int vcfRecordCmp(const void *va, const void *vb) /* Compare to sort based on position. */ { const struct vcfRecord *a = *((struct vcfRecord **)va); const struct vcfRecord *b = *((struct vcfRecord **)vb); int dif; dif = strcmp(a->chrom, b->chrom); if (dif == 0) dif = a->chromStart - b->chromStart; if (dif == 0) dif = a->chromEnd - b->chromEnd; // shortest first if (dif == 0)