4683b4d7108b748cb41e5c79a744079e6b55ef52
angie
  Wed Jul 28 13:34:56 2010 -0700
User John Hayward reported a sqlConnect without matching disconnect in doMiddle (genome, 6/16/10).  Turns out the connection is used only in doDv() -- moved it there and converted sqlConnect to hAllocConn+hFreeConn.  I don't think the dvBed track is live in any database now, so doDv is probably dead code anyway.
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 8740232..8155da1 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -244,8 +244,6 @@
 char *genome;		/* common name, e.g. Mouse, Human */
 char *scientificName;	/* Scientific name of organism. */
 
-char *protDbName;	/* Name of proteome database */
-struct sqlConnection *protDbConn; /* connection to proteins database */
 struct hash *trackHash;	/* A hash of all tracks - trackDb valued */
 
 void printLines(FILE *f, char *s, int lineSize);
@@ -20480,6 +20478,8 @@
 sqlFreeResult(&sr2);
 
 safef(query3, sizeof(query3), "select * from dvXref2 where varId = '%s' ", itemName);
+char *protDbName = hPdbFromGdb(database);
+struct sqlConnection *protDbConn = hAllocConn(protDbName);
 sr3 = sqlGetResult(protDbConn, query3);
 while ((row = sqlNextRow(sr3)) != NULL)
     {
@@ -20507,6 +20507,7 @@
     dvXref2Free(&dvXref2);
     }
 sqlFreeResult(&sr3);
+hFreeConn(&protDbConn);
 
 printTrackHtml(tdb);
 hFreeConn(&conn);
@@ -22139,9 +22140,6 @@
 
 setUdcCacheDir();
 
-protDbName = hPdbFromGdb(database);
-protDbConn = sqlConnect(protDbName);
-
 dbIsFound = sqlDatabaseExists(database);
 
 if (dbIsFound)