07662787383a971f5a26b83ab6f5d843c01a826b
max
  Thu Jan 16 04:38:41 2014 -0800
fixing null pointer bug in jksql introduced with my last commit
diff --git src/hg/lib/jksql.c src/hg/lib/jksql.c
index a5dedbd..a540299 100644
--- src/hg/lib/jksql.c
+++ src/hg/lib/jksql.c
@@ -562,38 +562,39 @@
 	    sqlHardUnlockAll(sc);
         if (monitorFlags & JKSQL_TRACE)
             monitorPrintInfo(sc, "SQL_DISCONNECT");
         monitorEnter();
 	mysql_close(conn);
 
 	deltaTime = monitorLeave();
 	if (monitorFlags & JKSQL_TRACE)
 	    monitorPrint(sc, "SQL_TIME", "%0.3fs", ((double)deltaTime)/1000.0);
 	}
     if (node != NULL)
 	{
 	dlRemove(node);
 	freeMem(node);
 	}
-    sqlNumOpenConnections--;
-    }
    
     // also close local cache connection
     if (sc->slowConn != NULL)
         sqlDisconnect(&sc->slowConn);
 
     freez(pSc);
+    sqlNumOpenConnections--;
+    }
+    
         
 }
 
 char* sqlGetDatabase(struct sqlConnection *sc)
 /* Get the database associated with an connection. Warning: return may be NULL! */
 {
 assert(!sc->isFree);
 if (sc->conn)
     return sc->conn->db;
 else
     return sc->db;
 }
 
 char* sqlGetHost(struct sqlConnection *sc)
 /* Get the host associated with an connection. */