Mercurial > hg > orthanc-python
changeset 123:5f0b7795afaf fix-leak
fixing the first leak
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Aug 2023 08:14:21 +0200 |
parents | 45722358d459 |
children | 35c0b2fc751c |
files | CMakeLists.txt Sources/RestCallbacks.cpp |
diffstat | 2 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Wed Aug 30 08:14:02 2023 +0200 +++ b/CMakeLists.txt Wed Aug 30 08:14:21 2023 +0200 @@ -178,6 +178,7 @@ Sources/OnChangeCallback.cpp Sources/OnStoredInstanceCallback.cpp Sources/Plugin.cpp + Sources/PythonBytes.cpp Sources/PythonFunction.cpp Sources/PythonLock.cpp Sources/PythonModule.cpp
--- a/Sources/RestCallbacks.cpp Wed Aug 30 08:14:02 2023 +0200 +++ b/Sources/RestCallbacks.cpp Wed Aug 30 08:14:21 2023 +0200 @@ -22,6 +22,7 @@ #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" #include "Autogenerated/sdk.h" +#include "PythonBytes.h" #include "PythonString.h" #include <boost/regex.hpp> @@ -170,8 +171,8 @@ if (request->method == OrthancPluginHttpMethod_Post || request->method == OrthancPluginHttpMethod_Put) { - PyDict_SetItemString(kw.GetPyObject(), "body", PyBytes_FromStringAndSize( - reinterpret_cast<const char*>(request->body), request->bodySize)); + PythonBytes bytes(lock, request->body, request->bodySize); + PyDict_SetItemString(kw.GetPyObject(), "body", bytes.GetPyObject()); } /**