“delete” pointer without destroying data
问题 I'm relatively new to C++. I'm allocating a buffer: uint8 *buffer = new uint8[len]; Using a 3rd party library, I use a method of an "img" object (it's a picture) to "take over" the buffer as raw image data: img->SetBuffer((uint8*)data); I suspect that "taking over" in practice means that the "img" object has its own pointer which after "SetBuffer" points to the data in "buffer". It all works fine, but my compiler complains (it's a warning, not an error) about a memory leak. If I add this line