279166ca6fde058a85d9889501a1509499251d16
jcasper
  Wed May 20 11:40:23 2026 -0700
Cleaning up an earlyBotCheck persistent SQL connection that snuck in, and
ensuring that sqlCleanupAll doesn't crash.  Some CGIs set up carefulMemHandler after earlyBotCheck,
so the connection list is a mix of two memory allocation setups.  Instead of trying to
manually free that memory at exit, sqlCleanupAll can let the system handle it.  refs #37494

diff --git src/hg/lib/jksql.c src/hg/lib/jksql.c
index 86f2f2a3a37..86e07312502 100644
--- src/hg/lib/jksql.c
+++ src/hg/lib/jksql.c
@@ -1060,31 +1060,30 @@
 void sqlCleanupAll(void)
 /* Cleanup all open connections and resources. */
 {
 if (sqlOpenConnections)
     {
     struct dlNode *conNode, *conNext;
     struct sqlConnection *conn;
     for (conNode = sqlOpenConnections->head; conNode->next != NULL; conNode = conNext)
 	{
 	conn = conNode->val;
 	conNext = conNode->next;
         conn->inCache = FALSE; // really should be cleaning up caches too
         conn->isFree = FALSE;
 	sqlDisconnect(&conn);
 	}
-    freeDlList(&sqlOpenConnections);
     }
 }
 
 static void sqlInitTracking(void)
 /* Initialize tracking and freeing of resources. */
 {
 if (sqlOpenConnections == NULL)
     {
     sqlOpenConnections = newDlList();
     atexit(sqlCleanupAll);
     }
 }
 
 static bool sqlIsUcscServer()
 /* Return TRUE if this is one of our own servers at UCSC */