/* clone buffer for upper or lower layer, because original buffer should be stored in l2cap  */
RTK_BUFFER* RtbCloneBuffer(IN RTK_BUFFER *pDataBuffer)
/* clone buffer for upper or lower layer, because original buffer should be stored in l2cap  */
RTK_BUFFER* RtbCloneBuffer(IN RTK_BUFFER *pDataBuffer)
{
    RTK_BUFFER* pNewBuffer = NULL;
    if(pDataBuffer)
    {
        pNewBuffer = RtbAllocate(pDataBuffer->Length,0);
        if(!pNewBuffer)
        {
            return NULL;
        }
        if(pDataBuffer && pDataBuffer->Data)
            memcpy(pNewBuffer->Data, pDataBuffer->Data, pDataBuffer->Length);
        else
        {
            RtbFree(pNewBuffer);
            return NULL;
        }
        pNewBuffer->Length = pDataBuffer->Length;
    }
    return pNewBuffer;
}