当前位置: 首页>>代码示例>>C++>>正文


C++ VMDIR_SAFE_FREE_MEMORY函数代码示例

本文整理汇总了C++中VMDIR_SAFE_FREE_MEMORY函数的典型用法代码示例。如果您正苦于以下问题:C++ VMDIR_SAFE_FREE_MEMORY函数的具体用法?C++ VMDIR_SAFE_FREE_MEMORY怎么用?C++ VMDIR_SAFE_FREE_MEMORY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了VMDIR_SAFE_FREE_MEMORY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: VmDirLogTerminate

VOID
VmDirLogTerminate(
    VOID
    )
{
    if ( _gpVmDirLogCtx )
    {
        if ( _gpVmDirLogCtx->pFile )
        {
            fclose( _gpVmDirLogCtx->pFile );
        }

        if ( _gpVmDirLogCtx->bSyslog )
        {
            if ( _gpVmDirLogCtx->pszSyslogDaemon )
            {
                closelog();
                VMDIR_SAFE_FREE_MEMORY( _gpVmDirLogCtx->pszSyslogDaemon);
            }
        }

        VMDIR_SAFE_FREE_MEMORY( _gpVmDirLogCtx->pszLogFileName );
        VMDIR_SAFE_FREE_MEMORY( _gpVmDirLogCtx );
    }

    return;

}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:28,代码来源:logging.c

示例2: VmDirFreeAttribute

/*
 * Free a heap Attribute
 * (ATTENTION: if the pAttr is within a pEntry, only when pEntry is constructed as
 * ENTRY_STORAGE_FORMAT_NORMAL allocation type, its attribute can be freed using this function;
 * otherwise, an entry's attribute free is taken care of by 'pEntry->bvs'
 */
VOID
VmDirFreeAttribute(
    PVDIR_ATTRIBUTE pAttr
    )
{
    if (!pAttr)
    {
        return;
    }

    // pAttr->type is always store in place and has NO bvnorm_val.  no need to free here.
    if (!dequeIsEmpty(&pAttr->valueMetaDataToAdd))
    {
        VmDirFreeAttrValueMetaDataDequeueContent(&pAttr->valueMetaDataToAdd);
    }
    if (!dequeIsEmpty(&pAttr->valueMetaDataToDelete))
    {
        VmDirFreeAttrValueMetaDataDequeueContent(&pAttr->valueMetaDataToDelete);
    }

    VmDirFreeMetaData(pAttr->pMetaData);

    VmDirFreeBervalContent(&pAttr->type);
    VmDirFreeBervalArrayContent(pAttr->vals, pAttr->numVals);
    VMDIR_SAFE_FREE_MEMORY(pAttr->vals);
    VMDIR_SAFE_FREE_MEMORY(pAttr);
}
开发者ID:vmware,项目名称:lightwave,代码行数:33,代码来源:vmdirentry.c

示例3: VmDirFreeUTDVectorCache

VOID
VmDirFreeUTDVectorCache(
    PVMDIR_UTDVECTOR_CACHE  pUTDVector
    )
{
    BOOLEAN bInLock = FALSE;

    if (!pUTDVector)
    {
        return;
    }

    VMDIR_RWLOCK_WRITELOCK(bInLock, pUTDVector->pUtdVectorLock, 0);

    if (pUTDVector->pUtdVectorMap)
    {
        LwRtlHashMapClear(pUTDVector->pUtdVectorMap, VmDirSimpleHashMapPairFreeKeyOnly, NULL);
        LwRtlFreeHashMap(&pUTDVector->pUtdVectorMap);
    }
    VMDIR_SAFE_FREE_MEMORY(pUTDVector->pszUtdVector);

    VMDIR_RWLOCK_UNLOCK(bInLock, pUTDVector->pUtdVectorLock);
    VMDIR_SAFE_FREE_RWLOCK(pUTDVector->pUtdVectorLock);

    VMDIR_SAFE_FREE_MEMORY(pUTDVector);
}
开发者ID:vmware,项目名称:lightwave,代码行数:26,代码来源:utdvector.c

示例4: _VmDirMDBInitializeDBEntry

static
DWORD
_VmDirMDBInitializeDBEntry(
    const char *pszDBPath,
    PVDIR_MDB_DB *ppDB
    )
{
    DWORD dwError = 0;
    PVDIR_MDB_DB pDB = NULL;

    if (!pszDBPath || !ppDB)
    {
        BAIL_WITH_VMDIR_ERROR(dwError, ERROR_INVALID_PARAMETER);
    }

    dwError = VmDirAllocateMemory (sizeof(VDIR_MDB_DB), ((PVOID*)&pDB));
    BAIL_ON_VMDIR_ERROR(dwError);

    dwError = VmDirAllocateStringA (pszDBPath, &pDB->pszDBPath);
    BAIL_ON_VMDIR_ERROR(dwError);

    *ppDB = pDB;

cleanup:
    return dwError;

error:
    if (pDB)
    {
        VMDIR_SAFE_FREE_MEMORY(pDB->pszDBPath);
        VMDIR_SAFE_FREE_MEMORY(pDB);
    }
    goto cleanup;
}
开发者ID:vmware,项目名称:lightwave,代码行数:34,代码来源:init.c

示例5: VmDirFreeBervalContent

VOID
VmDirFreeBervalContent(
    VDIR_BERVALUE* pBerv
    )
{
    if (!pBerv)
    {
        return;
    }

    if (pBerv->bvnorm_val != NULL &&
        pBerv->bvnorm_val != pBerv->lberbv.bv_val)
    {
        VMDIR_SAFE_FREE_MEMORY(pBerv->bvnorm_val);
    }

    if (pBerv->bOwnBvVal)
    {
        VMDIR_SAFE_FREE_MEMORY(pBerv->lberbv.bv_val);
    }

    memset(pBerv, 0, sizeof(*pBerv));

    return;
}
开发者ID:vmware,项目名称:lightwave,代码行数:25,代码来源:vmdirentry.c

示例6: VmDirMetaDataCopyContent

DWORD
VmDirMetaDataCopyContent(
    PVMDIR_ATTRIBUTE_METADATA    pSrcMetaData,
    PVMDIR_ATTRIBUTE_METADATA    pDestMetaData
    )
{
    DWORD    dwError = 0;

    if (VmDirMetaDataIsEmpty(pSrcMetaData) || !pDestMetaData)
    {
        BAIL_WITH_VMDIR_ERROR(dwError, VMDIR_ERROR_INVALID_PARAMETER);
    }

    pDestMetaData->localUsn = pSrcMetaData->localUsn;
    pDestMetaData->version = pSrcMetaData->version;

    VMDIR_SAFE_FREE_MEMORY(pDestMetaData->pszOrigInvoId);
    dwError = VmDirAllocateStringA(pSrcMetaData->pszOrigInvoId, &pDestMetaData->pszOrigInvoId);
    BAIL_ON_VMDIR_ERROR(dwError);

    VMDIR_SAFE_FREE_MEMORY(pDestMetaData->pszOrigTime);
    dwError = VmDirAllocateStringA(pSrcMetaData->pszOrigTime, &pDestMetaData->pszOrigTime);
    BAIL_ON_VMDIR_ERROR(dwError);

    pDestMetaData->origUsn = pSrcMetaData->origUsn;

cleanup:
    return dwError;

error:
    VMDIR_LOG_ERROR(VMDIR_LOG_MASK_ALL, "failed, error (%d)", dwError);
    goto cleanup;
}
开发者ID:vmware,项目名称:lightwave,代码行数:33,代码来源:metadata.c

示例7: VmDirSASLSessionClose

/*
 * Free SASL related resources.
 */
VOID
VmDirSASLSessionClose(
    PVDIR_SASL_BIND_INFO    pSaslBindInfo
    )
{
    if (pSaslBindInfo)
    {
        if (pSaslBindInfo->pSaslCtx)
        {
            if (pSaslBindInfo->saslSSF > 0)
            {
                VmDirSASLSockbufRemove(pSaslBindInfo->pSockbuf);
            }

            sasl_dispose(&pSaslBindInfo->pSaslCtx);
            pSaslBindInfo->pSaslCtx = NULL;
        }

        VMDIR_SAFE_FREE_MEMORY(pSaslBindInfo->pSessionCB);
        VMDIR_SAFE_FREE_MEMORY(pSaslBindInfo->pszBindUserName);
        VmDirFreeBervalContent(&pSaslBindInfo->bvMechnism);
    }

    return;
}
开发者ID:DhanashreeA,项目名称:lightwave,代码行数:28,代码来源:sasl.c

示例8: VmDirDDVectorShutdown

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);
}
开发者ID:vmware,项目名称:lightwave,代码行数:28,代码来源:deadlockdetectionvector.c

示例9: VmDirFreeBervalArrayContent

VOID
VmDirFreeBervalArrayContent(
    PVDIR_BERVALUE pBervs,
    USHORT  usSize
    )
{
    USHORT usCnt = 0;

    if (pBervs != NULL)
    {
        for (usCnt = 0; usCnt < usSize; usCnt++)
        {
            if (pBervs[usCnt].bvnorm_val != NULL &&
                pBervs[usCnt].bvnorm_val != pBervs[usCnt].lberbv.bv_val)
            {
                VMDIR_SAFE_FREE_MEMORY(pBervs[usCnt].bvnorm_val);
            }

            if (pBervs[usCnt].bOwnBvVal)
            {
                VMDIR_SAFE_FREE_MEMORY(pBervs[usCnt].lberbv.bv_val);
            }

        }

        memset(pBervs, 0, sizeof(*pBervs) * usSize);
    }
}
开发者ID:vmware,项目名称:lightwave,代码行数:28,代码来源:vmdirentry.c

示例10: VmDirMDBIndexIteratorFree

VOID
VmDirMDBIndexIteratorFree(
    PVDIR_BACKEND_INDEX_ITERATOR    pIterator
    )
{
    PVDIR_MDB_INDEX_ITERATOR    pMdbIterator = NULL;

    if (pIterator)
    {
        pMdbIterator = (PVDIR_MDB_INDEX_ITERATOR)pIterator->pIterator;
        if (pMdbIterator)
        {
            if (pMdbIterator->pCursor)
            {
                mdb_cursor_close(pMdbIterator->pCursor);
            }
            if (pMdbIterator->pTxn)
            {
                if (pMdbIterator->bAbort)
                {
                    mdb_txn_abort(pMdbIterator->pTxn);
                }
                else
                {
                    mdb_txn_commit(pMdbIterator->pTxn);
                }
            }
            VMDIR_SAFE_FREE_MEMORY(pMdbIterator->pszVal);
            VMDIR_SAFE_FREE_MEMORY(pMdbIterator);
        }
        VMDIR_SAFE_FREE_MEMORY(pIterator);
    }
}
开发者ID:nks5295,项目名称:lightwave,代码行数:33,代码来源:iterate.c

示例11: _VmDirRidSyncThr

static
DWORD
_VmDirRidSyncThr(
    PVOID    pArg
    )
{
    DWORD               dwError = 0;
    BOOLEAN             bInLock = FALSE;
    PVDIR_THREAD_INFO   pThrInfo = (PVDIR_THREAD_INFO)pArg;
    PVMDIR_SID_GEN_STACK_NODE pSidGenStackNode = NULL;

    VMDIR_LOG_VERBOSE( VMDIR_LOG_MASK_ALL, "_VmDirRidSyc thr started" );

    while (1)
    {
        if (VmDirdState() == VMDIRD_STATE_SHUTDOWN)
        {
            goto cleanup;
        }

        VMDIR_SAFE_FREE_MEMORY(pSidGenStackNode);
        while (VmDirPopTSStack(gSidGenState.pStack, (PVOID*)&pSidGenStackNode) == 0 &&
               pSidGenStackNode != NULL)
        {
            (VOID)VmDirSyncRIDSeqToDB(
                    pSidGenStackNode->pszDomainDn,
                    pSidGenStackNode->dwDomainRidSequence);

            if (VmDirdState() == VMDIRD_STATE_SHUTDOWN)
            {
                //
                // Any pending updates will be performed by VmDirVmAclShutdown.
                //
                goto cleanup;
            }

            VMDIR_SAFE_FREE_MEMORY(pSidGenStackNode);
        }

        VMDIR_LOCK_MUTEX(bInLock, pThrInfo->mutexUsed);

        VmDirConditionTimedWait(
            pThrInfo->conditionUsed,
            pThrInfo->mutexUsed,
            3 * 1000);          // time wait 3 seconds
        // ignore error

        VMDIR_UNLOCK_MUTEX(bInLock, pThrInfo->mutexUsed);
    }

cleanup:

    VMDIR_LOG_VERBOSE( VMDIR_LOG_MASK_ALL, "_VmDirRidSyc thr stopped (%d)", dwError );

    VMDIR_SAFE_FREE_MEMORY(pSidGenStackNode);

    return dwError;
}
开发者ID:DhanashreeA,项目名称:lightwave,代码行数:58,代码来源:ridsyncthr.c

示例12: VdcHashMapFreeStringPair

VOID
VdcHashMapFreeStringPair(
    PLW_HASHMAP_PAIR pPair,
    LW_PVOID pUserData
    )
{
    VMDIR_SAFE_FREE_MEMORY(pPair->pKey);
    VMDIR_SAFE_FREE_MEMORY(pPair->pValue);
}
开发者ID:divyamehta,项目名称:lightwave,代码行数:9,代码来源:main.c

示例13: _VmGetHighestCommittedUSN

static
DWORD
_VmGetHighestCommittedUSN(
    PSTR*   ppszHighestCommittedUSN
    )
{
    DWORD               dwError = 0;
    USN                 usn = 0;
    USN                 nextUSN = 0;
    VDIR_ENTRY_ARRAY    entryArray = {0};
    PSTR                pszUSN = NULL;
    VDIR_BACKEND_CTX    beCtx = {0};

    beCtx.pBE = VmDirBackendSelect(NULL);
    assert(beCtx.pBE);

    dwError = beCtx.pBE->pfnBEGetNextUSN(&beCtx, &nextUSN);
    BAIL_ON_VMDIR_ERROR(dwError);

    for (usn=nextUSN; usn > 1LL; usn--)
    {
        VMDIR_SAFE_FREE_MEMORY(pszUSN);
        VmDirFreeEntryArrayContent(&entryArray);

        dwError = VmDirAllocateStringPrintf(&pszUSN, "%" PRId64, usn);
        BAIL_ON_VMDIR_ERROR(dwError);

        dwError = VmDirSimpleEqualFilterInternalSearch(
                    "", LDAP_SCOPE_SUBTREE, ATTR_USN_CHANGED, pszUSN, &entryArray);
        BAIL_ON_VMDIR_ERROR(dwError);

        if (entryArray.iSize == 1 )
        {
            break;
        }
    }

    if (usn == 0)
    {
        BAIL_WITH_VMDIR_ERROR(dwError, VMDIR_ERROR_INVALID_STATE);
    }

    *ppszHighestCommittedUSN = pszUSN;
    pszUSN = NULL;

cleanup:
    VMDIR_SAFE_FREE_MEMORY(pszUSN);
    VmDirFreeEntryArrayContent(&entryArray);
    VmDirBackendCtxContentFree(&beCtx);

    return dwError;

error:
    VMDIR_LOG_ERROR(VMDIR_LOG_MASK_ALL, "error (%u), start USN %" PRId64, dwError, nextUSN);
    goto cleanup;
}
开发者ID:vmware,项目名称:lightwave,代码行数:56,代码来源:dbswap.c

示例14: _FreeSearchInformation

static
VOID
_FreeSearchInformation(
        PVMDIR_SUPERLOG_ENTRY_LDAPOPERATION pEntry)
{
    VMDIR_SAFE_FREE_MEMORY(pEntry->opInfo.searchInfo.pwszAttributes);
    VMDIR_SAFE_FREE_MEMORY(pEntry->opInfo.searchInfo.pwszBaseDN);
    VMDIR_SAFE_FREE_MEMORY(pEntry->opInfo.searchInfo.pwszScope);
    VMDIR_SAFE_FREE_MEMORY(pEntry->opInfo.searchInfo.pwszIndexResults);
}
开发者ID:divyamehta,项目名称:lightwave,代码行数:10,代码来源:superlogutil.c

示例15: _FreeStringPair

static
VOID
_FreeStringPair(
    PLW_HASHMAP_PAIR pPair,
    LW_PVOID pUnused
    )
{
    VMDIR_SAFE_FREE_MEMORY(pPair->pKey);
    VMDIR_SAFE_FREE_MEMORY(pPair->pValue);
}
开发者ID:divyamehta,项目名称:lightwave,代码行数:10,代码来源:partnerschema.c


注:本文中的VMDIR_SAFE_FREE_MEMORY函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。