Hi,
I changed the use from “OrthancPlugins::MemoryBuffer” to “OrthancPluginMemoryBuffer” (and OrthancPluginFreeMemoryBuffer) for my
answerBody variable and the crash didn’t happen anymore.
Is that better to use “OrthancPlugins::MemoryBuffer” method or “OrthancPluginMemoryBuffer”?
Idem for many methods : OrthancPluginRegisterRestCallback or OrthancPlugins::RegisterRestCallback ?
If you are developing in C++, it is clearly easier and safer to use the wrapper functions from the “OrthancPlugins” namespace, as they automatically handle memory allocation and error reporting thanks to the RAII design pattern: https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization