I have come across a code during review and when i used cpp check it states an null pointer dereference error. I am unable to figure out the reason. Below is the code:
CopyMemory(NULL, dummyMatrixManager.GetConstDataPtr(), dummyMatrixManager.GetNumberOfElements() * sizeof(tFloat));
void CopyMemory( tFloat* pDst, const tFloat* pSrc, const tSize nBytes )
{
// copy data if pointer to this memory is valid
if (NULL != pDst)
{
memcpy(pDst, pSrc, nBytes);
}
else
{
LOG_ERROR("No Data copied because memory was not properly allocated. Destination pointer was set to NULL.");
}
}
Thank you