Mercurial > hg > orthanc-python
comparison Sources/RestCallbacks.cpp @ 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 | eb6ac5a801d1 |
children | 9ffe8881f856 |
comparison
equal
deleted
inserted
replaced
122:45722358d459 | 123:5f0b7795afaf |
---|---|
20 | 20 |
21 #include "RestCallbacks.h" | 21 #include "RestCallbacks.h" |
22 | 22 |
23 #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" | 23 #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h" |
24 #include "Autogenerated/sdk.h" | 24 #include "Autogenerated/sdk.h" |
25 #include "PythonBytes.h" | |
25 #include "PythonString.h" | 26 #include "PythonString.h" |
26 | 27 |
27 #include <boost/regex.hpp> | 28 #include <boost/regex.hpp> |
28 | 29 |
29 | 30 |
168 } | 169 } |
169 | 170 |
170 if (request->method == OrthancPluginHttpMethod_Post || | 171 if (request->method == OrthancPluginHttpMethod_Post || |
171 request->method == OrthancPluginHttpMethod_Put) | 172 request->method == OrthancPluginHttpMethod_Put) |
172 { | 173 { |
173 PyDict_SetItemString(kw.GetPyObject(), "body", PyBytes_FromStringAndSize( | 174 PythonBytes bytes(lock, request->body, request->bodySize); |
174 reinterpret_cast<const char*>(request->body), request->bodySize)); | 175 PyDict_SetItemString(kw.GetPyObject(), "body", bytes.GetPyObject()); |
175 } | 176 } |
176 | 177 |
177 /** | 178 /** |
178 * Call the user-defined function | 179 * Call the user-defined function |
179 **/ | 180 **/ |