eb91bdbd593e04364d969b7461c1f690325da0e5
chmalee
  Tue Oct 20 16:39:13 2020 -0700
Fix bug in ref/alt name shortening in vcfToBed, refs #25010

diff --git src/hg/utils/vcfToBed/vcfToBed.c src/hg/utils/vcfToBed/vcfToBed.c
index ad7b49c..dfae97e 100644
--- src/hg/utils/vcfToBed/vcfToBed.c
+++ src/hg/utils/vcfToBed/vcfToBed.c
@@ -158,32 +158,32 @@
 struct dyString *name = dyStringNew(0);
 struct dyString *shortenedRef = dyStringNew(0);
 struct dyString *shortenedAlt = dyStringNew(0);
 char *line = NULL;
 char *chopped[9]; // 9 fields in case VCF has genotype fields, keep them separate from info fields
 int infoCount = slCount(vcff->infoDefs);
 char *infoTags[infoCount];
 while (lineFileNext(vcff->lf, &line, NULL))
     {
     int fieldCount = chopTabs(line, chopped);
     if (fieldCount < 8)
         errAbort("ERROR: malformed VCF, missing fields at line: '%d'", vcff->lf->lineIx);
     char *chrom = fixupChromName(chopped[0]);
     int start = atoi(chopped[1]);
     int end = start + 1;
-    char *ref = chopped[3];
-    char *alt = chopped[4];
+    char *ref = cloneString(chopped[3]);
+    char *alt = cloneString(chopped[4]);
     if (strlen(ref) == dnaFilteredSize(ref))
         end = start + strlen(ref);
     fixupLeftPadding(&start, ref, alt);
     if (!sameString(chopped[2], "."))
         dyStringPrintf(name, "%s", chopped[2]);
     else
         {
         shortenRefAltString(shortenedRef, shortenedAlt, ref, alt);
         dyStringPrintf(name, "%s_%d:%s/%s", chrom,start,shortenedRef->string,shortenedAlt->string);
         }
     fprintf(outBed, "%s\t%d\t%d\t%s\t0\t.\t%d\t%d\t0,0,0", chrom,start,end,name->string,start,end);
     fprintf(outBed, "\t%s\t%s\t%s", ref, alt, chopped[6]);
     if (extraFieldCount)
         {
         fprintf(outBed, "\t");