rem: while ((dsPtr = cgiPtr->firstPtr) != NULL) { cgiPtr->firstPtr = dsPtr->addr; Ns_DStringPush(dsPtr);
add: while ((bufPtr = cgiPtr->firstBufPtr) != NULL) { cgiPtr->firstBufPtr = bufPtr->nextPtr; Ns_DStringPush(bufPtr->dsPtr); ns_free(bufPtr);
context: CgiFree(Cgi *cgiPtr){    Ns_DString *dsPtr;    /*     * Close the pipe.     */        if (cgiPtr->ofd >= 0) {    	close(cgiPtr->ofd);    }            /*     * Truncate and release the temp file.     */    if (cgiPtr->tmpPtr != NULL) {    	CgiFreeTmp(cgiPtr->tmpPtr);    }         /*     * Free the environment.     */         if (cgiPtr->env != NULL) {	Ns_SetFree(cgiPtr->env);    }    /*     * Push back all dstrings.     */    while ((dsPtr = cgiPtr->firstPtr) != NULL) {	cgiPtr->firstPtr = dsPtr->addr;	Ns_DStringPush(dsPtr);    }        /*     * Reap the process.     */         if (cgiPtr->pid != -1 && Ns_WaitProcess(cgiPtr->pid) != NS_OK) {	Ns_Log(Error, "nscgi: wait for %s failed: %s",	       cgiPtr->exec, strerror(errno));    }}