The function that callers ConvertToChar() must delete the memory when done with it. That's a common requirement of programming. Of course you could also return std::string instead of char* which would eliminate the need for allocation -- but if this is for eVC++ compiler you won't have that option. A third option is to make the calling function pass in a pointer to the buffer.
char* ConvertToChar(const CString &s, char* pAnsiString, int bufsize)
{
wcstombs(pAnsiString,(LPCTSTR) s, bufsize);
return pAnsiString;
}
Also, you might as well delete that memset line, no point wasting cpu cycles clearing memory and immediately copying something else into that same memory.