I was thinking more along the lines of what Elysia mentioned. Sometimes you just have to call into a C library, and either pass ownership of a buffer (which the C library must free() ), or take ownership of a buffer (which your C++ code must free() ).
It's easy to argue that the library is poorly designed, and I would agree, but sometimes it's unavoidable (calling the library, that is).