0f2b15b55316a468c710d89d7078ac6aa95a2bc8
angie
  Mon Jun 24 09:02:45 2013 -0700
Fixing problems with the way hgTables and hgVai handled failed position searches.fixes #10964, refs #6152

diff --git src/hg/hgVai/libifyMe.c src/hg/hgVai/libifyMe.c
index 6d6dd04..8cfca59 100644
--- src/hg/hgVai/libifyMe.c
+++ src/hg/hgVai/libifyMe.c
@@ -21,31 +21,31 @@
 #include "annoFormatVep.h"
 #include "pgSnp.h"
 #include "vcf.h"
 
 #include "libifyMe.h"
 
 static boolean searchPosition(char *range, struct cart *cart, char *cartVar)
 /* Try and fill in region via call to hgFind. Return FALSE
  * if it can't find a single position. */
 {
 struct hgPositions *hgp = NULL;
 char retAddr[512];
 char position[512];
 char *chrom = NULL;
 int start=0, end=0;
-char *db = cartString(cart, "db");
+char *db = cloneString(cartString(cart, "db")); // gets clobbered if position is not found!
 safef(retAddr, sizeof(retAddr), "%s", cgiScriptName());
 hgp = findGenomePosWeb(db, range, &chrom, &start, &end,
 	cart, TRUE, retAddr);
 if (hgp != NULL && hgp->singlePos != NULL)
     {
     safef(position, sizeof(position),
 	    "%s:%d-%d", chrom, start+1, end);
     cartSetString(cart, cartVar, position);
     return TRUE;
     }
 else if (start == 0)	/* Confusing way findGenomePosWeb says pos not found. */
     {
     cartSetString(cart, cartVar, hDefaultPos(db));
     return FALSE;
     }