2fd1f4e705f129be8654845b0ca452862706cd06 angie Fri Jun 15 17:13:32 2018 -0700 corner case: hFreeConn was not called when a peakClusters input track table doesn't exist, leading to 'too many connections' error when none of the input tables exist diff --git src/hg/hgc/peakClusters.c src/hg/hgc/peakClusters.c index 1372ec9..28f85d3 100644 --- src/hg/hgc/peakClusters.c +++ src/hg/hgc/peakClusters.c @@ -57,33 +57,32 @@ if (sqlTableExists(conn, table)) // Table might be withdrawn from data thrash { int rowOffset; struct sqlResult *sr = hRangeQuery(conn, table, cluster->chrom, cluster->chromStart, cluster->chromEnd, NULL, &rowOffset); int signalCol = sqlFieldColumn(sr, "signalValue"); if (signalCol < 0) internalErr(); char **row; while ((row = sqlNextRow(sr)) != NULL) { count += 1; sum += sqlDouble(row[signalCol]); } sqlFreeResult(&sr); - hFreeConn(&conn); } - +hFreeConn(&conn); if (count > 0) return sum/count; else return 0; } static void printControlledVocabFields(char **row, int fieldCount, struct slName *fieldList, char *vocabFile, struct hash *vocabHash) /* Print out fields from row, linking them to controlled vocab if need be. * If vocabFile is NULL, the vocabHash is not ENCODE, so links + mouseovers are * generated differently */ { int i; struct slName *field; for (i=0, field = fieldList; i<fieldCount; ++i, field = field->next)