rem: if (connPtr->authPasswd != NULL) { ns_free(connPtr->authPasswd); }
context: NsConnThread(void *arg){    Arg    	    *argPtr = arg;    NsServer	    *servPtr = argPtr->servPtr;    Conn            *connPtr;    Ns_Time          wait, *timePtr;    unsigned int     id;    char             thrname[32];    int              status;    char            *p;    Ns_Set	    *headers, *outputheaders;    Ns_Thread	     joinThread;        /*     * Set the conn thread name.     */    Ns_MutexLock(&servPtr->queue.lock);    id = servPtr->threads.nextid++;    Ns_MutexUnlock(&servPtr->queue.lock);    sprintf(thrname, "-conn%d-", id);     Ns_ThreadSetName(thrname);    /*     * Pre-allocate some sets and warm up Tcl.      */    headers = Ns_SetCreate(NULL);    outputheaders = Ns_SetCreate(NULL);    /*     * Signal that conn threads appear warmed up if necessary and     * start handling connections.     */    Ns_MutexLock(&servPtr->queue.lock);    while (1) {	/*	 * Wait for a connection to arrive, exiting if one doesn't	 * arrive in the configured timeout period.	 */	if (servPtr->threads.current <= servPtr->threads.min) {	    timePtr = NULL;	} else {	    Ns_GetTime(&wait);	    Ns_IncrTime(&wait, servPtr->threads.timeout, 0);	    timePtr = &wait;	}	status = NS_OK;    	while (!servPtr->queue.shutdown		&& status == NS_OK		&& servPtr->queue.wait.firstPtr == NULL) {	    status = Ns_CondTimedWait(&servPtr->queue.cond, &servPtr->queue.lock, timePtr);	}	if (servPtr->queue.wait.firstPtr == NULL) {	    break;	}	/*	 * Pull the first connection of the waiting list.	 */    	connPtr = servPtr->queue.wait.firstPtr;    	servPtr->queue.wait.firstPtr = connPtr->nextPtr;     	if (servPtr->queue.wait.lastPtr == connPtr) {	    servPtr->queue.wait.lastPtr = NULL;    	}	connPtr->nextPtr = NULL;	connPtr->prevPtr = servPtr->queue.active.lastPtr;	if (servPtr->queue.active.lastPtr != NULL) {	    servPtr->queue.active.lastPtr->nextPtr = connPtr;	}	servPtr->queue.active.lastPtr = connPtr;	if (servPtr->queue.active.firstPtr == NULL) {	    servPtr->queue.active.firstPtr = connPtr;	}	servPtr->threads.idle--;	servPtr->queue.wait.num--;	argPtr->connPtr = connPtr;    	Ns_MutexUnlock(&servPtr->queue.lock);		/*	 * Re-initialize and run the connection.	 */	sprintf(connPtr->idstr, "cns%d", connPtr->id);	connPtr->headers = headers;	connPtr->outputheaders = outputheaders;	ConnRun(connPtr);	/*	 * Perform various garbage collection tasks.  Note	 * the order is significant:  The driver freeProc could	 * possibly use Tcl and Tcl deallocate callbacks	 * could possibly access header and/or request data.	 */	if (connPtr->interp != NULL) {            Ns_TclDeAllocateInterp(connPtr->interp);	}	if (connPtr->request != NULL) {            Ns_FreeRequest(connPtr->request);	}        if (connPtr->authUser != NULL) {	    ns_free(connPtr->authUser);	}        if (connPtr->authPasswd != NULL) {            ns_free(connPtr->authPasswd);	}	if (connPtr->query != NULL) {	    Ns_SetFree(connPtr->query);	}	/*	 * NB: Headers and/or output headers could have been	 * modified by the connection and/or cleanups.	 */	headers = connPtr->headers;	outputheaders = connPtr->outputheaders;        Ns_SetTrunc(headers, 0);        Ns_SetTrunc(outputheaders, 0);	/*	 * Remove from the active list and push on the free list.	 */	Ns_MutexLock(&servPtr->queue.lock);	argPtr->connPtr = NULL;	if (connPtr->prevPtr != NULL) {	    connPtr->prevPtr->nextPtr = connPtr->nextPtr;	} else {	    servPtr->queue.active.firstPtr = connPtr->nextPtr;	}	if (connPtr->nextPtr != NULL) {	    connPtr->nextPtr->prevPtr = connPtr->prevPtr;	} else {	    servPtr->queue.active.lastPtr = connPtr->prevPtr;	}	servPtr->threads.idle++;	connPtr->nextPtr = servPtr->queue.freePtr;	servPtr->queue.freePtr = connPtr;	if (connPtr->nextPtr == NULL) {	    /*	     * If this thread just free'd up the busy server,	     * run the ready procs to signal other subsystems.	     */	    Ns_MutexUnlock(&servPtr->queue.lock);	    NsRunAtReadyProcs();	    Ns_MutexLock(&servPtr->queue.lock);	}    }    servPtr->threads.idle--;    servPtr->threads.current--;    if (servPtr->threads.current == 0) {    	Ns_CondBroadcast(&servPtr->queue.cond);    }    if (servPtr->queue.shutdown) {	p = "shutdown pending";    } else {	p = "no waiting connections";    }    joinThread = servPtr->threads.last;    Ns_ThreadSelf(&servPtr->threads.last);    Ns_MutexUnlock(&servPtr->queue.lock);    Ns_SetFree(headers);    Ns_SetFree(outputheaders);    if (joinThread != NULL) {	JoinConnThread(&joinThread);    }    Ns_ThreadExit(argPtr);}