DWORD TestInfrastructureCleanup( PVMDIR_TEST_STATE pState ) { DWORD dwError = 0; if (pState->pLd == NULL) { return 0; } dwError = VmDirTestDeleteUser(pState, NULL, VmDirTestGetInternalUserCn(pState)); BAIL_ON_VMDIR_ERROR(dwError); dwError = VmDirTestDeleteContainer(pState, NULL); BAIL_ON_VMDIR_ERROR(dwError); cleanup: VmDirFreeStringA((PSTR)pState->pszBaseDN); VmDirTestLdapUnbind(pState->pLd); VmDirTestLdapUnbind(pState->pLdLimited); VmDirTestLdapUnbind(pState->pLdAnonymous); VmDirTestLdapUnbind(pState->pLdCustom); return 0; error: printf("Test cleanup failed with error %d\n", dwError); goto cleanup; }
static VOID VmDirPagedSearchCacheRecordFree( PVDIR_PAGED_SEARCH_RECORD pSearchRecord ) { PVOID pvData = NULL; BOOLEAN bInLock = FALSE; if (pSearchRecord == NULL) { return; } VMDIR_LOCK_MUTEX(bInLock, gPagedSearchCache.mutex); (VOID)LwRtlHashTableRemove(gPagedSearchCache.pHashTbl, &pSearchRecord->Node); VMDIR_UNLOCK_MUTEX(bInLock, gPagedSearchCache.mutex); VmDirFreeStringA(pSearchRecord->pszGuid); DeleteFilter(pSearchRecord->pFilter); while (dequePop(pSearchRecord->pQueue, (PVOID*)&pvData) == 0) { VmDirFreeMemory(pvData); } dequeFree(pSearchRecord->pQueue); VmDirFreeMutex(pSearchRecord->mutex); VmDirFreeCondition(pSearchRecord->pDataAvailable); VmDirSrvThrFree(pSearchRecord->pThreadInfo); VmDirFreeMemory(pSearchRecord); }
VOID VmDirStringListFreeContent( PVMDIR_STRING_LIST pStringList ) { DWORD i = 0; if (pStringList != NULL) { for (i = 0; i < pStringList->dwCount; ++i) { VmDirFreeStringA((PSTR)pStringList->pStringList[i]); } pStringList->dwCount = 0; } }
/* * free array of PSTR * assume array stop at PSTR == NULL */ VOID VmDirFreeStringArrayA( PSTR* ppszString ) { DWORD dwCnt = 0; if (!ppszString) { return; } for (dwCnt = 0; ppszString[dwCnt]; dwCnt++) { VmDirFreeStringA(ppszString[dwCnt]); } return; }