8d51bc5b5ac00d46f63b5de9ca41f4666fbd16cc
kent
  Tue Jan 18 23:54:54 2011 -0800
Fixing memory allocation problem where one path through the code was not allocating return value dynamically, causing trouble when it was later freed.
diff --git src/hg/hgTables/bigWig.c src/hg/hgTables/bigWig.c
index 24e75d4..d37169a 100644
--- src/hg/hgTables/bigWig.c
+++ src/hg/hgTables/bigWig.c
@@ -38,31 +38,31 @@
 char *bigWigFileName(char *table, struct sqlConnection *conn)
 /* Return file name associated with bigWig.  This handles differences whether it's
  * a custom or built-in track.  Do a freeMem on returned string when done. */
 {
 char *fileName = NULL;
 if (isCustomTrack(table))
     {
     struct customTrack *ct = ctLookupName(table);
     if (ct != NULL)
         fileName = cloneString(trackDbSetting(ct->tdb, "bigDataUrl"));
     }
 else if (isHubTrack(table))
     {
     struct trackDb *tdb = hashFindVal(fullTrackAndSubtrackHash, table);
     assert(tdb != NULL);
-    fileName = trackDbSetting(tdb, "bigDataUrl");
+    fileName = cloneString(trackDbSetting(tdb, "bigDataUrl"));
     assert(fileName != NULL);
     }
 else
     {
     char query[256];
     safef(query, sizeof(query), "select fileName from %s", table);
     fileName = sqlQuickString(conn, query);
     }
 return fileName;
 }
 
 struct bbiInterval *intersectedFilteredBbiIntervalsOnRegion(struct sqlConnection *conn, 
 	struct bbiFile *bwf, struct region *region, enum wigCompare filterCmp, double filterLl,
 	double filterUl, struct lm *lm)
 /* Get list of bbiIntervals (more-or-less bedGraph things from bigWig) out of bigWig file