e09c2a865147bf97bc9bc218d6baeb921cb2448b
jcasper
  Thu May 21 07:17:31 2026 -0700
Gotta remember to close early connections in botDelay stuff, refs #37494

diff --git src/hg/lib/botDelay.c src/hg/lib/botDelay.c
index b5ed5044f7d..11c9c21fa6f 100644
--- src/hg/lib/botDelay.c
+++ src/hg/lib/botDelay.c
@@ -128,31 +128,34 @@
 
 boolean isValidHguid(char *cookieUserId)
 /* Check if a particular hguid is valid, i.e. well-formatted, has matching id and secure string,
  * and isn't corrupted. */
 {
 if (isEmpty(cookieUserId))
     return FALSE;
 boolean isValid = FALSE;
 struct sqlConnection *conn = hConnectCentralNoCache();
 char query[2048];
 if (cartDbHasSessionKey(conn, userDbTable()))
     {
     char *sessionKey = NULL;
     unsigned id = cartDbParseId(cookieUserId, &sessionKey);
     if (sessionKey == NULL)
+        {
+        sqlDisconnect(&conn);
         return FALSE;
+        }
     sqlSafef(query, sizeof(query), "select id from %s where id = %u and sessionKey = '%s'",
             userDbTable(), id, sessionKey);
     }
 else
     {
     sqlSafef(query, sizeof(query), "select id from %s where id = %u", userDbTable(), sqlUnsigned(cookieUserId));
     }
 if (sqlExists(conn, query))
     isValid = TRUE;
 sqlDisconnect(&conn);
 return isValid;
 }
 
 static void recordHguidIpAndMaybeForceCaptcha()
 /* When hguidIpTracking is enabled in hg.conf, upsert this request's