Well, there are several more warnings during the compilation process, and some of them helped me to trace down a couple of tricky bugs. So, thanks Pelle again!
Regarding to the warnings, when I free an allocated buffer, and the same buffer is also freed elsewhere, the compiler shows the following:
void foo(void)
{
char *buffer = malloc(32);
if (buffer == NULL) return;
buffer[0] = '\0';
DWORD dwRet = GetLastError(); <-- Just an example. This is not important.
if (dwRet)
{
free(buffer);
return;
}
free(buffer); <-- warning #2116: Local 'buffer' is used without being initialized (or using a dangling value).
}
To 'fix' the warning, I have to modify the code as following:
void foo(void)
{
char *buffer = malloc(32);
if (buffer == NULL) return;
buffer[0] = '\0';
DWORD dwRet = GetLastError();
if (dwRet)
{
free(buffer); buffer = NULL; <-- 'fix'
return;
}
free(buffer); <-- no more warning
}