Would it be more appropriate to use Marshal::FreeHGlobal() instead of Marshal::FreeCoTaskMem()? My MSDN ...
stackoverflow.com