I suspect that the compiler complains about how the 'buffer' pointer is passed to the 'realloc' function.
Yes, and I think this is the only really problematic case for the generic __declspec(release( )) annotation in the C runtime. If realloc() succeeds you shouldn't touch buffer, but if realloc() fails you want to clean up. If f.e. fclose() fails, it's unlikely anyone would call fclose() again to see if it works any better...
The choices I can think of are:
1) Do something special for realloc() - but I hate special cases, they usually come back and bite you in the end.
2) Remove the __declspec(release( )) annotation from realloc() - this will obviously shut up all the noise, but also drop any useful warnings...
What do you think?