// This function removes the key from the stack
void CCrypto_Blake2::Blake2_SecureZeroMemory(void *pvBuffer, uint64 u64Len)
{
try
{
CHECK_MEM_LEAKS
void *(*const volatile memset_v)(void *, int, size_t) = &memset;
memset_v(pvBuffer, 0, size_t(u64Len));
}
catch(...) { OnException(m_pWstrDebugLog, __FILE__, __LINE__, __FUNCSIG__, __TIMESTAMP__, nullptr); }
}
But, I get the error 'Uninitialized variable: memset_v twice (one on each of the relevant code lines).
Clearly, I'm initializing memset_v with the address of the memset function. Why do I still get an uninitialized variable error?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using this code snippet only i can not reproduce this useing Cppcheck 1.88 or 1.89 dev.
Some other code seems to be necessary to get the error message. Maybe some commandline parameter or other option is relevant.
Can you try to find a small standalone example where Cppcheck complains?
Or if that is not possible, if you get this for an open source project we can try to automatically reduce the code with the script "tools/reduce.py" from Cppcheck making sure it can still be reproduced.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have the following member function:
But, I get the error 'Uninitialized variable: memset_v twice (one on each of the relevant code lines).
Clearly, I'm initializing memset_v with the address of the memset function. Why do I still get an uninitialized variable error?
Using this code snippet only i can not reproduce this useing Cppcheck 1.88 or 1.89 dev.
Some other code seems to be necessary to get the error message. Maybe some commandline parameter or other option is relevant.
Can you try to find a small standalone example where Cppcheck complains?
Or if that is not possible, if you get this for an open source project we can try to automatically reduce the code with the script "tools/reduce.py" from Cppcheck making sure it can still be reproduced.