On 22 Oct 2009, at 13:54, Erik Hofman wrote: > - std::auto_ptr<unsigned char> ptr( buf.c_str() ); > + std::auto_ptr<unsigned char> ptr( (unsigned char*) > buf.c_str() );
This still looks wrong to me - you can't create an auto_ptr from buf.c_str(), it will delete memory that's not supposed to be deleted. To make this safe, fundamentally you need to allocate a buffer, copy buf.c_str() into it, and pass that buffer in via the auto_ptr. There is no way (that I can see) that this code can ever be safe, without using a copy to turn the temporary data from c_str() into something that lives on the heap. Regards, James ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel