static VOID VmAfWinCfgFreeConnection( PVMAF_CFG_CONNECTION pConnection ) { VmAfdFreeMemory(pConnection); }
DWORD VmAfdCreateAnonymousConnectionContextImpl( PVM_AFD_CONNECTION_CONTEXT *ppConnectionContext ) { DWORD dwError = 0; PVM_AFD_CONNECTION_CONTEXT pConnectionContext = NULL; PVM_AFD_SECURITY_CONTEXT pSecurityContext = NULL; if (ppConnectionContext == NULL) { dwError = ERROR_INVALID_PARAMETER; BAIL_ON_VMAFD_ERROR (dwError); } dwError = VmAfdAllocateMemory ( sizeof(VM_AFD_CONNECTION_CONTEXT), (PVOID *) &pConnectionContext ); BAIL_ON_VMAFD_ERROR (dwError); dwError = VmAfdAllocateMemory( sizeof (VM_AFD_SECURITY_CONTEXT), (PVOID *)&pSecurityContext); BAIL_ON_VMAFD_ERROR (dwError); pSecurityContext->uid = 0; pConnectionContext->pConnection = NULL; pConnectionContext->pSecurityContext = pSecurityContext; pConnectionContext->bAnonymousContext = TRUE; *ppConnectionContext = pConnectionContext; cleanup: return dwError; error: if (ppConnectionContext != NULL){ *ppConnectionContext = NULL; } if (pSecurityContext){ VmAfdFreeSecurityContext(pSecurityContext); } if (pConnectionContext){ VmAfdFreeMemory(pConnectionContext); } goto cleanup; }
VOID DirCliFreeCert( PDIR_CLI_CERT pCert ) { VMAFD_SAFE_FREE_MEMORY(pCert->pszSubjectName); VMAFD_SAFE_FREE_MEMORY(pCert->pszFingerPrint); if (pCert->pX509Cert) { X509_free(pCert->pX509Cert); } VmAfdFreeMemory(pCert); }
VOID VmAfdFreeRegArgs( PVMAFD_REG_ARG pArgs ) { if ( pArgs ) { VMAFD_SAFE_FREE_MEMORY(pArgs->pszAccount); VMAFD_SAFE_FREE_MEMORY(pArgs->pszAccountDN); VMAFD_SAFE_FREE_MEMORY(pArgs->pszPassword); VMAFD_SAFE_FREE_MEMORY(pArgs->pszDomain); VMAFD_SAFE_FREE_MEMORY(pArgs->pszAccountUPN); VmAfdFreeMemory(pArgs); } }
VOID VmAfWinCfgCloseKey( PVMAF_CFG_KEY pKey ) { if (pKey->pConnection) { if (pKey->hKey) { RegCloseKey(pKey->hKey); } VmAfWinCfgCloseConnection(pKey->pConnection); } VmAfdFreeMemory(pKey); }
static VOID VmAfdFreeTokenGroups( PTOKEN_GROUPS pTokenGroups) { unsigned int i = 0; if (pTokenGroups) { for (i = 0; i < pTokenGroups->GroupCount; i++) { VMAFD_SAFE_FREE_MEMORY(pTokenGroups->Groups[i].Sid); } VmAfdFreeMemory(pTokenGroups); } }
DWORD VmAfdSuperLoggingInit( PVMSUPERLOGGING *ppLogger ) { PVMSUPERLOGGING pLogger = NULL; DWORD dwError = 0; DWORD dwCapacity = 0; dwError = VmAfdAllocateMemory(sizeof(*pLogger), (PVOID)&pLogger); BAIL_ON_VMAFD_ERROR(dwError); _VmAfdSuperLoggingReadRegistry( &dwCapacity, &pLogger->bEnabled); dwError = VmAfdCircularBufferCreate( dwCapacity, sizeof(VMAFD_SUPERLOG_ENTRY), &pLogger->pCircularBuffer); BAIL_ON_VMAFD_ERROR(dwError); // Note: Keep event log publisher disabled until we have a run-time on/off switch if (0) { dwError = _VmAfdInitEventLogPublisherThread(pLogger->pCircularBuffer); BAIL_ON_VMAFD_ERROR(dwError); } *ppLogger = pLogger; VmAfdLog(VMAFD_DEBUG_ANY, "Super Logger object is created."); cleanup: return dwError; error: if (pLogger != NULL) { VmAfdCircularBufferFree(pLogger->pCircularBuffer); VmAfdFreeMemory(pLogger); pLogger = NULL; } goto cleanup; }
VOID VmAfdShutdownRootFlushThread( PVMAFD_THREAD pThread ) { DWORD dwError = 0; if (pThread && pThread->pThread && pThread->thrData.pCond) { VmAfdSetShutdownFlagRootFlushThr(&pThread->thrData); dwError = pthread_cond_signal(pThread->thrData.pCond); if (dwError != 0) { VmAfdLog(VMAFD_DEBUG_ANY, "Condition Signaling Failed. Error [%d]", dwError); } dwError = pthread_join(*pThread->pThread, NULL); if (dwError != 0) { VmAfdLog(VMAFD_DEBUG_ANY, "Thread join Failed. Error [%d]", dwError); } if (pThread->thrData.pCond) { pthread_cond_destroy(pThread->thrData.pCond); pThread->thrData.pCond = NULL; } if (pThread->thrData.pMutex) { pthread_mutex_destroy(pThread->thrData.pMutex); pThread->thrData.pMutex = NULL; } } VmAfdFreeMemory(pThread); }
VOID VecsDbFreeContext( PVECS_DB_CONTEXT pDbContext ) { while (pDbContext) { PVECS_DB_CONTEXT pContext = pDbContext; pDbContext = pDbContext->pNext; if (pContext->pAddCertQuery) { sqlite3_finalize(pContext->pAddCertQuery); } if (pContext->pQueryAllCertificates) { sqlite3_finalize(pContext->pQueryAllCertificates); } if (pContext->pQueryCertificatesPaged) { sqlite3_finalize(pContext->pQueryCertificatesPaged); } if (pContext->pTotalCertCountQuery) { sqlite3_finalize(pContext->pTotalCertCountQuery); } if (pContext->pDelCertQuery) { sqlite3_finalize(pContext->pDelCertQuery); } if (pContext->pUpdateCertQuery) { sqlite3_finalize(pContext->pUpdateCertQuery); } if (pContext->pGetCertFromAliasQuery) { sqlite3_finalize(pContext->pGetCertFromAliasQuery); } if (pContext->pVerifyCertQuery) { sqlite3_finalize(pContext->pVerifyCertQuery); } if (pContext->pGetCountQuery) { sqlite3_finalize(pContext->pGetCountQuery); } if (pContext->pCreateStoreTable) { sqlite3_finalize(pContext->pCreateStoreTable); } if (pContext->pDeleteStore) { sqlite3_finalize(pContext->pDeleteStore); } if (pContext->pQueryStoreTable) { sqlite3_finalize(pContext->pQueryStoreTable); } if (pContext->pGetPKeyFromAlias) { sqlite3_finalize(pContext->pGetPKeyFromAlias); } if (pContext->pQueryInfoLevel1) { sqlite3_finalize(pContext->pQueryInfoLevel1); } if (pContext->pQueryInfoLevel2) { sqlite3_finalize(pContext->pQueryInfoLevel2); } if (pContext->pQueryTypeByAlias) { sqlite3_finalize(pContext->pQueryTypeByAlias); } if (pContext->pQueryDateByAlias) { sqlite3_finalize(pContext->pQueryDateByAlias); } if (pContext->pQuerySetSecurityDescriptor) { sqlite3_finalize(pContext->pQuerySetSecurityDescriptor); } if (pContext->pQueryGetSecurityDescriptor) { sqlite3_finalize(pContext->pQueryGetSecurityDescriptor); } if (pContext->pQueryAddAces) { sqlite3_finalize (pContext->pQueryAddAces); } if (pContext->pQueryGetAces) { sqlite3_finalize (pContext->pQueryGetAces); } if (pContext->pQueryAddAcesArray) { VecsDbFreeStmtArray(pContext->pQueryAddAcesArray); } if (pContext->pDb) { VecsDbDatabaseClose(pContext->pDb); } VmAfdFreeMemory(pContext); } }