VOID VmDirDDVectorShutdown( VOID ) { BOOLEAN bInLock = FALSE; if (gVmdirServerGlobals.pReplDeadlockDetectionVector) { VMDIR_LOCK_MUTEX(bInLock, gVmdirServerGlobals.pReplDeadlockDetectionVector->pMutex); if (gVmdirServerGlobals.pReplDeadlockDetectionVector->pEmptyPageSentMap) { LwRtlHashMapClear( gVmdirServerGlobals.pReplDeadlockDetectionVector->pEmptyPageSentMap, VmDirSimpleHashMapPairFree, NULL); LwRtlFreeHashMap(&gVmdirServerGlobals.pReplDeadlockDetectionVector->pEmptyPageSentMap); } VMDIR_SAFE_FREE_MEMORY(gVmdirServerGlobals.pReplDeadlockDetectionVector->pszInvocationId); VMDIR_UNLOCK_MUTEX(bInLock, gVmdirServerGlobals.pReplDeadlockDetectionVector->pMutex); } VMDIR_SAFE_FREE_MUTEX(gVmdirServerGlobals.pReplDeadlockDetectionVector->pMutex); VMDIR_SAFE_FREE_MEMORY(gVmdirServerGlobals.pReplDeadlockDetectionVector); }
DWORD VmDirAllocateMutex( PVMDIR_MUTEX* ppMutex ) { DWORD dwError = ERROR_SUCCESS; PVMDIR_MUTEX pVmDirMutex = NULL; if ( ppMutex == NULL ) { dwError = ERROR_INVALID_PARAMETER; BAIL_ON_VMDIR_ERROR(dwError); } dwError = VmDirAllocateMemory( sizeof(VMDIR_MUTEX), ((PVOID*)&pVmDirMutex)); BAIL_ON_VMDIR_ERROR(dwError); dwError = VmDirInitializeMutexContent( pVmDirMutex ); BAIL_ON_VMDIR_ERROR(dwError); *ppMutex = pVmDirMutex; pVmDirMutex = NULL; error: VMDIR_SAFE_FREE_MUTEX( pVmDirMutex ); return dwError; }
static VOID _VmDirSASLMutexDispose( PVOID pSASLMutex ) { PVMDIR_MUTEX pLocalMutex = (PVMDIR_MUTEX) pSASLMutex; VMDIR_SAFE_FREE_MUTEX(pLocalMutex); return; }
VOID VdirSchemaInstanceFree( PVDIR_SCHEMA_INSTANCE pSchema ) { DWORD dwCnt = 0; if ( pSchema ) { for (dwCnt=0; dwCnt < pSchema->ocs.usNumOCs; dwCnt++) { VmDirSchemaOCDescContentFree(&pSchema->ocs.pOCSortName[dwCnt]); } VMDIR_SAFE_FREE_MEMORY(pSchema->ocs.pOCSortName); pSchema->ocs.usNumOCs = 0; for (dwCnt=0; dwCnt < pSchema->ats.usNumATs; dwCnt++) { VmDirSchemaATDescContentFree(&pSchema->ats.pATSortName[dwCnt]); } VMDIR_SAFE_FREE_MEMORY(pSchema->ats.pATSortName); VMDIR_SAFE_FREE_MEMORY(pSchema->ats.ppATSortIdMap); pSchema->ats.usNumATs = 0; for (dwCnt=0; dwCnt < pSchema->contentRules.usNumContents; dwCnt++) { VmDirSchemaContentDescContentFree(&pSchema->contentRules.pContentSortName[dwCnt]); } VMDIR_SAFE_FREE_MEMORY(pSchema->contentRules.pContentSortName); pSchema->contentRules.usNumContents = 0; for (dwCnt=0; dwCnt < pSchema->structureRules.usNumStructures; dwCnt++) { VmDirSchemaStructureDescContentFree(&pSchema->structureRules.pStructureSortRuleID[dwCnt]); } VMDIR_SAFE_FREE_MEMORY(pSchema->structureRules.pStructureSortRuleID); pSchema->structureRules.usNumStructures = 0; for (dwCnt=0; dwCnt < pSchema->nameForms.usNumNameForms; dwCnt++) { VmDirSchemaNameformDescContentFree( &pSchema->nameForms.pNameFormSortName[dwCnt] ); } VMDIR_SAFE_FREE_MEMORY(pSchema->nameForms.pNameFormSortName); pSchema->nameForms.usNumNameForms = 0; VMDIR_SAFE_FREE_MUTEX( pSchema->mutex ); VMDIR_SAFE_FREE_MEMORY(pSchema); } return; }
VOID VmDirSchemaLibShutdown( VOID ) { BOOLEAN bInLock = FALSE; VMDIR_LOCK_MUTEX(bInLock, gVdirSchemaGlobals.mutex); // release live context and live schema VmDirSchemaCtxRelease(gVdirSchemaGlobals.pCtx); VMDIR_SAFE_FREE_MEMORY(gVdirSchemaGlobals.pszDN); VMDIR_UNLOCK_MUTEX(bInLock, gVdirSchemaGlobals.mutex); VMDIR_SAFE_FREE_MUTEX( gVdirSchemaGlobals.mutex ); }
VOID VmDirPagedSearchCacheFree( VOID ) { PLW_HASHTABLE_NODE pNode = NULL; LW_HASHTABLE_ITER iter = LW_HASHTABLE_ITER_INIT; PVDIR_PAGED_SEARCH_RECORD pSearchRecord = NULL; if (gPagedSearchCache.pHashTbl != NULL) { while ((pNode = LwRtlHashTableIterate(gPagedSearchCache.pHashTbl, &iter))) { pSearchRecord = LW_STRUCT_FROM_FIELD(pNode, VDIR_PAGED_SEARCH_RECORD, Node); LwRtlHashTableRemove(gPagedSearchCache.pHashTbl, pNode); VmDirPagedSearchCacheRecordFree(pSearchRecord); } LwRtlFreeHashTable(&gPagedSearchCache.pHashTbl); } VMDIR_SAFE_FREE_MUTEX(gPagedSearchCache.mutex); }
static PVOID _VmDirSASLMutexNew( VOID ) { DWORD dwError = 0; PVMDIR_MUTEX pLocalMutex = NULL; dwError = VmDirAllocateMutex(&pLocalMutex); BAIL_ON_VMDIR_ERROR(dwError); cleanup: return pLocalMutex; error: VMDIR_LOG_ERROR( VMDIR_LOG_MASK_ALL, "_VmDirSASLMutexNew failed (%d)", dwError); VMDIR_SAFE_FREE_MUTEX(pLocalMutex); goto cleanup; }