Mercurial > hg > orthanc-python
diff Sources/IncomingHttpRequestFilter.cpp @ 131:c55b0583084b
integration fix-leak->mainline
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Aug 2023 11:52:45 +0200 |
parents | a3f77cf16396 a862d554753f |
children | 71d305c29cfa |
line wrap: on
line diff
--- a/Sources/IncomingHttpRequestFilter.cpp Wed Aug 30 11:49:59 2023 +0200 +++ b/Sources/IncomingHttpRequestFilter.cpp Wed Aug 30 11:52:45 2023 +0200 @@ -51,11 +51,15 @@ } PythonObject kw(lock, PyDict_New()); - PyDict_SetItemString(kw.GetPyObject(), "method", PyLong_FromLong(method)); + + { + PythonObject tmp(lock, PyLong_FromLong(method)); + PyDict_SetItemString(kw.GetPyObject(), "method", tmp.GetPyObject()); + } { PythonString str(lock, ip); - PyDict_SetItemString(kw.GetPyObject(), "ip", str.Release()); + PyDict_SetItemString(kw.GetPyObject(), "ip", str.GetPyObject()); } { @@ -64,10 +68,10 @@ for (uint32_t i = 0; i < headersCount; i++) { PythonString str(lock, headersValues[i]); - PyDict_SetItemString(headers.GetPyObject(), headersKeys[i], str.Release()); + PyDict_SetItemString(headers.GetPyObject(), headersKeys[i], str.GetPyObject()); } - PyDict_SetItemString(kw.GetPyObject(), "headers", headers.Release()); + PyDict_SetItemString(kw.GetPyObject(), "headers", headers.GetPyObject()); } if (method == OrthancPluginHttpMethod_Get) @@ -77,10 +81,10 @@ for (uint32_t i = 0; i < getArgumentsCount; i++) { PythonString str(lock, getArgumentsValues[i]); - PyDict_SetItemString(getArguments.GetPyObject(), getArgumentsKeys[i], str.Release()); + PyDict_SetItemString(getArguments.GetPyObject(), getArgumentsKeys[i], str.GetPyObject()); } - PyDict_SetItemString(kw.GetPyObject(), "get", getArguments.Release()); + PyDict_SetItemString(kw.GetPyObject(), "get", getArguments.GetPyObject()); } PythonObject result(lock, PyObject_Call(incomingHttpRequestFilter_,