void sbChanDestroy(sbChanObj* pThis) { # if FEATURE_LISTENER == 1 sbProfObj *pProf; # endif sbChanCHECKVALIDOBJECT(pThis); /* This is a safeguard to make sure no * leak is left. Normally, the profile cleans * up this pointer. But it can't do so if e.g. * the channel is aborted. So we do it for it, * but obiously, we can't do it smartly - so we * just free() the memory. */ if(pThis->pProfInstance != NULL) free(pThis->pProfInstance); # if FEATURE_LISTENER == 1 pProf = pThis->pProf; # endif /* we now need to remove the channel object from the session's * channel list. */ sbNVTRRemoveKeyU(pThis->pSess->pChannels, pThis->uChanNum); # if FEATURE_LISTENER == 1 if(pProf != NULL) if(pProf->bDestroyOnChanClose == TRUE) sbProfDestroy(pProf); # endif SRFREEOBJ(pThis); }
void sbProfDestroy(sbProfObj* pThis) { sbProfCHECKVALIDOBJECT(pThis); if(pThis->pszProfileURI != NULL) free(pThis->pszProfileURI); SRFREEOBJ(pThis); }
void sbChanAbort(sbChanObj* pThis) { sbChanCHECKVALIDOBJECT(pThis); if(pThis->pProf != NULL) if(pThis->pProf->bDestroyOnChanClose == TRUE) { sbProfDestroy(pThis->pProf); } SRFREEOBJ(pThis); }
srRetVal sbSockExit(struct sbSockObject *pThis) { srRetVal iRetVal = SR_RET_OK; sbSockCHECKVALIDOBJECT(pThis); if(pThis->sock != INVALID_SOCKET) { iRetVal = sbSockClosesocket(pThis); /* OK, we may have failed, but at this stage we still continue * our processing - otherwise we may have an additional memory * leak! */ } if(pThis->pRemoteHostIP != NULL) free(pThis->pRemoteHostIP); SRFREEOBJ(pThis); /* there is nothing we can do if free() fails... */ return(iRetVal); }